diff mercurial/wireprotoserver.py @ 37064:884a0c1604ad

wireproto: define attr-based classes for representing frames When frames only had 3 attributes, it was reasonable to represent them as a tuple. With them growing more attributes, it will be easier to pass them around as a more formal type. So let's define attr-based classes to represent frame headers and full frames. Differential Revision: https://phab.mercurial-scm.org/D2899
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 15 Mar 2018 16:03:14 -0700
parents bbea991635d0
children a8a902d7176e
line wrap: on
line diff
--- a/mercurial/wireprotoserver.py	Wed Mar 14 22:19:00 2018 -0700
+++ b/mercurial/wireprotoserver.py	Thu Mar 15 16:03:14 2018 -0700
@@ -400,12 +400,11 @@
             states.append(b'received: <no frame>')
             break
 
-        requestid, frametype, frameflags, payload = frame
-        states.append(b'received: %d %d %d %s' % (frametype, frameflags,
-                                                  requestid, payload))
+        states.append(b'received: %d %d %d %s' % (frame.typeid, frame.flags,
+                                                  frame.requestid,
+                                                  frame.payload))
 
-        action, meta = reactor.onframerecv(requestid, frametype, frameflags,
-                                           payload)
+        action, meta = reactor.onframerecv(frame)
         states.append(json.dumps((action, meta), sort_keys=True,
                                  separators=(', ', ': ')))
 
@@ -434,7 +433,7 @@
         if not frame:
             break
 
-        action, meta = reactor.onframerecv(*frame)
+        action, meta = reactor.onframerecv(frame)
 
         if action == 'wantframe':
             # Need more data before we can do anything.