Commit 0d70a6a7 authored by Antoine Millet's avatar Antoine Millet
Browse files

Fixed bug on tunnel shutdown when the connection is already down

parent 62094088
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ import threading
import socket

from sjrpc.core.protocols import Protocol
from sjrpc.core.exceptions import RpcConnectionError

import pyev

@@ -141,7 +142,10 @@ class TunnelProtocol(Protocol):
            self._endpoint_reader.stop()
            self._endpoint_writer.stop()
            # Send the end of stream message to the peer:
            try:
                self._connection.rpc.send_special('protoctl', label=self._label, type='eos')
            except RpcConnectionError:
                pass  # Ignore errors when connection is down.
            # Execute the callback:
            self._cb_on_shutdown(self)
            super(TunnelProtocol, self).shutdown()