Minor re-arrangement of fields and code documentation improvements.
authorDavin McCall <davmac@davmac.org>
Thu, 24 Dec 2015 23:39:24 +0000 (23:39 +0000)
committerDavin McCall <davmac@davmac.org>
Thu, 24 Dec 2015 23:39:24 +0000 (23:39 +0000)
control.h

index 42ba5a7e3fc289cdf6aee3751d08fbc4cdeda129..616c728ee198474c3674cb07dd50896b27a4cc92 100644 (file)
--- a/control.h
+++ b/control.h
@@ -41,22 +41,25 @@ class ControlConn
     struct ev_io iob;
     struct ev_loop *loop;
     ServiceSet *service_set;
-    char * iobuf;
-    int bufidx;
     
     bool bad_conn_close; // close when finished output?
     bool oom_close;      // send final 'out of memory' indicator
+
+    // The packet length before we need to re-check if the packet is complete.
+    // processPacket() will not be called until the packet reaches this size.
+    int chklen;
+    
+    char * iobuf;
+    int bufidx;
     
     template <typename T> using list = std::list<T>;
     template <typename T> using vector = std::vector<T>;
     
     // Buffer for outgoing packets. Each outgoing back is represented as a vector<char>.
     list<vector<char>> outbuf;
+    // Current index within the first outgoing packet (all previous bytes have been sent).
     unsigned outpkt_index = 0;
     
-    // The packet length before we need to re-check if the packet is complete
-    int chklen;
-    
     // Queue a packet to be sent
     //  Returns:  true if the packet was successfully queued, false if otherwise
     //            (eg if out of memory); in the latter case the connection might