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.
|
||||
"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def is_connected(self):
|
||||
"""
|
||||
Check if the underlying transport is connected.
|
||||
"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def onDisconnect(self):
|
||||
"""
|
||||
|
@ -496,9 +496,12 @@ class ApplicationSession(BaseSession):
|
||||
"""
|
||||
if self._transport:
|
||||
self._transport.close()
|
||||
else:
|
||||
# XXX or shall we just ignore this?
|
||||
raise RuntimeError("No transport, but disconnect() called.")
|
||||
|
||||
def is_connected(self):
|
||||
"""
|
||||
Implements :func:`autobahn.wamp.interfaces.ISession.is_connected`
|
||||
"""
|
||||
return self._transport is not None
|
||||
|
||||
def onUserError(self, e, msg):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user