##// END OF EJS Templates
wireprotov2: change name and behavior of readframe()...
Gregory Szorc -
r40055:f5a05bb4 default
parent child Browse files
Show More
@@ -712,7 +712,7 b' class httpv2executor(object):'
712 def _handleresponse(self, handler, resp):
712 def _handleresponse(self, handler, resp):
713 # Called in a thread to read the response.
713 # Called in a thread to read the response.
714
714
715 while handler.readframe(resp):
715 while handler.readdata(resp):
716 pass
716 pass
717
717
718 # TODO implement interface for version 2 peers
718 # TODO implement interface for version 2 peers
@@ -148,6 +148,7 b' class clienthandler(object):'
148 self._requests = {}
148 self._requests = {}
149 self._futures = {}
149 self._futures = {}
150 self._responses = {}
150 self._responses = {}
151 self._frameseof = False
151
152
152 def callcommand(self, command, args, f):
153 def callcommand(self, command, args, f):
153 """Register a request to call a command.
154 """Register a request to call a command.
@@ -180,18 +181,23 b' class clienthandler(object):'
180
181
181 return meta['framegen']
182 return meta['framegen']
182
183
183 def readframe(self, fh):
184 def readdata(self, framefh):
184 """Attempt to read and process a frame.
185 """Attempt to read data and do work.
185
186
186 Returns None if no frame was read. Presumably this means EOF.
187 Returns None if no data was read. Presumably this means we're
188 done with all read I/O.
187 """
189 """
188 frame = wireprotoframing.readframe(fh)
190 if not self._frameseof:
189 if frame is None:
191 frame = wireprotoframing.readframe(framefh)
190 # TODO tell reactor?
192 if frame is None:
191 return
193 # TODO tell reactor?
194 self._frameseof = True
195 else:
196 self._ui.note(_('received %r\n') % frame)
197 self._processframe(frame)
192
198
193 self._ui.note(_('received %r\n') % frame)
199 if self._frameseof:
194 self._processframe(frame)
200 return None
195
201
196 return True
202 return True
197
203
General Comments 0
You need to be logged in to leave comments. Login now