Commit f7bb1d31 authored by Antoine Millet's avatar Antoine Millet
Browse files

Added "Tunnel ready" feature to the TunnelProtocol

parent bb0e8209
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -43,8 +43,8 @@ class TunnelProtocol(Protocol):
                     callback=self._handle_from_tunnel)
        self._endpoint_writer = self._connection.create_watcher(pyev.Io, **props)

        # Ask some data to the peer:
        self._send_get(TunnelProtocol.GET_SIZE)
        self._connection.rpc.send_special('protoctl', label=self._label,
                                          type='ready')

    def _handle_from_endpoint(self, watcher, revents):
        '''
@@ -96,3 +96,7 @@ class TunnelProtocol(Protocol):
            size = payload.get('size', TunnelProtocol.DEFAULT_GET_SIZE)
            self._ok_to_send += size
            self._endpoint_reader.start()
        elif control_type == 'ready':
            self._send_get(TunnelProtocol.GET_SIZE)
            self._ok_to_send += TunnelProtocol.GET_SIZE
            self._endpoint_reader.start()