svn commit: r259196 - head/sbin/hastd

Mikolaj Golub trociny at FreeBSD.org
Tue Dec 10 20:09:49 UTC 2013


Author: trociny
Date: Tue Dec 10 20:09:49 2013
New Revision: 259196
URL: http://svnweb.freebsd.org/changeset/base/259196

Log:
  Check remote protocol version only for the first connection (when it
  is actually sent by the remote node).
  
  Otherwise it generated confusing "Negotiated protocol version 1" debug
  messages when processing the second connection.
  
  MFC after:	2 weeks

Modified:
  head/sbin/hastd/hastd.c

Modified: head/sbin/hastd/hastd.c
==============================================================================
--- head/sbin/hastd/hastd.c	Tue Dec 10 20:06:41 2013	(r259195)
+++ head/sbin/hastd/hastd.c	Tue Dec 10 20:09:49 2013	(r259196)
@@ -806,12 +806,6 @@ listen_accept(struct hastd_listen *lst)
 		 */
 		version = 1;
 	}
-	if (version > HAST_PROTO_VERSION) {
-		pjdlog_info("Remote protocol version %hhu is not supported, falling back to version %hhu.",
-		    version, (unsigned char)HAST_PROTO_VERSION);
-		version = HAST_PROTO_VERSION;
-	}
-	pjdlog_debug(1, "Negotiated protocol version %hhu.", version);
 	token = nv_get_uint8_array(nvin, &size, "token");
 	/*
 	 * NULL token means that this is first connection.
@@ -925,6 +919,12 @@ listen_accept(struct hastd_listen *lst)
 	 */
 
 	if (token == NULL) {
+		if (version > HAST_PROTO_VERSION) {
+			pjdlog_info("Remote protocol version %hhu is not supported, falling back to version %hhu.",
+			    version, (unsigned char)HAST_PROTO_VERSION);
+			version = HAST_PROTO_VERSION;
+		}
+		pjdlog_debug(1, "Negotiated protocol version %hhu.", version);
 		res->hr_version = version;
 		arc4random_buf(res->hr_token, sizeof(res->hr_token));
 		nvout = nv_alloc();


More information about the svn-src-all mailing list