]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
client: fix attempt number in requests to be in network order
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 11 Nov 2016 15:53:51 +0000 (16:53 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 15 Nov 2016 13:55:25 +0000 (14:55 +0100)
client.c

index c05dd0e44f44d159169536cc9509c495b3db2cf4..e76c16aa1870694275d01728709c81a8597542a1 100644 (file)
--- a/client.c
+++ b/client.c
@@ -1294,7 +1294,6 @@ submit_request(CMD_Request *request, CMD_Reply *reply)
   request->res2 = 0;
   tx_sequence = sequence++;
   request->sequence = htonl(tx_sequence);
-  request->attempt = 0;
   request->pad1 = 0;
   request->pad2 = 0;
 
@@ -1304,6 +1303,7 @@ submit_request(CMD_Request *request, CMD_Reply *reply)
 
   do {
     request->version = proto_version;
+    request->attempt = htons(n_attempts);
     command_length = PKL_CommandLength(request);
     padding_length = PKL_CommandPaddingLength(request);
     assert(command_length > 0 && command_length > padding_length);
@@ -1324,9 +1324,6 @@ submit_request(CMD_Request *request, CMD_Reply *reply)
 
     DEBUG_LOG(LOGF_Client, "Sent %d bytes", command_length);
 
-    /* Increment this for next time */
-    ++ request->attempt;
-      
     tv.tv_sec = timeout / 1000;
     tv.tv_usec = timeout % 1000 * 1000;
     timeout *= 2;