diff --git a/sjrpc/core/protocols/tunnel.py b/sjrpc/core/protocols/tunnel.py index 5ec98b13c08db59e32f1a2baeffa2e47ff18333a..6e62269a28a535a995514c7876615d088ebfba53 100644 --- a/sjrpc/core/protocols/tunnel.py +++ b/sjrpc/core/protocols/tunnel.py @@ -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()