ignore calling disconnect on session that isn't connected; add is_connected()
This commit is contained in:
parent
9ba652a53d
commit
e6092d6546
@ -322,6 +322,12 @@ class ISession(object):
|
|||||||
Close the underlying transport.
|
Close the underlying transport.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
def is_connected(self):
|
||||||
|
"""
|
||||||
|
Check if the underlying transport is connected.
|
||||||
|
"""
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def onDisconnect(self):
|
def onDisconnect(self):
|
||||||
"""
|
"""
|
||||||
|
@ -496,9 +496,12 @@ class ApplicationSession(BaseSession):
|
|||||||
"""
|
"""
|
||||||
if self._transport:
|
if self._transport:
|
||||||
self._transport.close()
|
self._transport.close()
|
||||||
else:
|
|
||||||
# XXX or shall we just ignore this?
|
def is_connected(self):
|
||||||
raise RuntimeError("No transport, but disconnect() called.")
|
"""
|
||||||
|
Implements :func:`autobahn.wamp.interfaces.ISession.is_connected`
|
||||||
|
"""
|
||||||
|
return self._transport is not None
|
||||||
|
|
||||||
def onUserError(self, e, msg):
|
def onUserError(self, e, msg):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user