Browse Source

r13972@catbus: nickm | 2007-07-29 00:01:38 -0400
Make our control events for multi-line async replies conform to our old grammar. Change back to the old grammar (which got "corrected" in r10931).


svn:r10964

Nick Mathewson 17 years ago
parent
commit
964e4a305d
3 changed files with 12 additions and 6 deletions
  1. 2 0
      ChangeLog
  2. 4 4
      doc/spec/control-spec.txt
  3. 6 2
      src/or/control.c

+ 2 - 0
ChangeLog

@@ -91,6 +91,8 @@ Changes in version 0.2.0.3-alpha - 2007-07-29
       compatibility, ADDRMAP events only provide GMT expiry in an extended
       field. "GETINFO address-mappings" always does the right thing.
     - Use CRLF line endings properly in NS events.
+    - Terminate multi-line control events properly. (Original patch from tup.)
+      [Bugfix on 0.1.2.x-alpha]
 
   o Minor bugfixes (misc):
     - Choose perfectly fairly among routers when choosing by bandwidth and

+ 4 - 4
doc/spec/control-spec.txt

@@ -64,7 +64,7 @@ $Id$
 
     Reply = SyncReply / AsyncReply
     SyncReply = *(MidReplyLine / DataReplyLine) EndReplyLine
-    AsyncReply = *MidReplyLine EndReplyLine / DataReplyLine
+    AsyncReply = *(MidReplyLine / DataReplyLine) EndReplyLine
 
     MidReplyLine = StatusCode "-" ReplyLine
     DataReplyLine = StatusCode "+" ReplyLine Data
@@ -954,7 +954,7 @@ $Id$
   The syntax is:
      "650" SP Severity SP ReplyText
   or
-     "650+" Severity CRLF Data
+     "650+" Severity CRLF Data 650 SP "OK" CRLF
 
      Severity = "DEBUG" / "INFO" / "NOTICE" / "WARN"/ "ERR"
 
@@ -985,7 +985,7 @@ $Id$
 
   Syntax:
      "650" "+" "AUTHDIR_NEWDESCS" CRLF Action CRLF Message CRLF
-       Descriptor CRLF "." CRLF
+       Descriptor CRLF "." CRLF "650" SP "OK" CRLF
      Action = "ACCEPTED" / "DROPPED" / "REJECTED"
      Message = Text
 
@@ -1316,7 +1316,7 @@ $Id$
 4.1.12. Network status has changed
 
   Syntax:
-     "650" "+" "NS" CRLF  1*NetworkStatus "." CRLF
+     "650" "+" "NS" CRLF  1*NetworkStatus "." CRLF "650" SP "OK" CRLF
 
   [First added in 0.1.2.3-alpha]
 

+ 6 - 2
src/or/control.c

@@ -3145,8 +3145,9 @@ control_event_or_authdir_new_descriptor(const char *action,
   strlcpy(buf, firstline, totallen);
   strlcpy(buf+strlen(firstline), esc, totallen);
   send_control_event_string(EVENT_AUTHDIR_NEWDESCS, ALL_NAMES|ALL_FORMATS,
-                             buf);
-
+                            buf);
+  send_control_event_string(EVENT_AUTHDIR_NEWDESCS, ALL_NAMES|ALL_FORMATS,
+                            "650 OK\r\n");
   tor_free(esc);
   tor_free(buf);
 
@@ -3178,6 +3179,9 @@ control_event_networkstatus_changed(smartlist_t *statuses)
   smartlist_free(strs);
   tor_free(s);
   send_control_event_string(EVENT_NS, ALL_NAMES|ALL_FORMATS, esc);
+  send_control_event_string(EVENT_NS, ALL_NAMES|ALL_FORMATS,
+                            "650 OK\r\n");
+
   tor_free(esc);
   return 0;
 }