Include desired state of service in SERVICERECORD packets.
authorDavin McCall <davmac@davmac.org>
Wed, 30 Dec 2015 00:29:09 +0000 (00:29 +0000)
committerDavin McCall <davmac@davmac.org>
Wed, 30 Dec 2015 00:29:09 +0000 (00:29 +0000)
control.cc

index cfe029e9cc8b7f25f5e37696cfad3e9e04c4a162..c54bbc200fbb99be35888a1415268fc30b553190 100644 (file)
@@ -67,7 +67,7 @@ void ControlConn::processFindLoad(int pktType)
     
     uint16_t svcSize;
     rbuf.extract((char *)&svcSize, 1, 2);
-    chklen = svcSize + 3;
+    chklen = svcSize + 3; // packet type + (2 byte) length + service name
     if (svcSize <= 0 || chklen > 1024) {
         // Queue error response / mark connection bad
         char badreqRep[] = { DINIT_RP_BADREQ };
@@ -104,12 +104,13 @@ void ControlConn::processFindLoad(int pktType)
         // Allocate a service handle
         handle_t handle = allocateServiceHandle(record);
         std::vector<char> rp_buf;
-        rp_buf.reserve(6);
+        rp_buf.reserve(7);
         rp_buf.push_back(DINIT_RP_SERVICERECORD);
         rp_buf.push_back(static_cast<char>(record->getState()));
         for (int i = 0; i < (int) sizeof(handle); i++) {
             rp_buf.push_back(*(((char *) &handle) + i));
         }
+        rp_buf.push_back(static_cast<char>(record->getTargetState()));
         if (! queuePacket(std::move(rp_buf))) return;
     }
     else {