Fix regression with idle_timout not correctly closing connection. Fix errors due to Portal and Server trying to send to non-existing sessions after connection closes.
This commit is contained in:
parent
2737d37633
commit
67411d006d
2 changed files with 7 additions and 3 deletions
|
|
@ -435,7 +435,9 @@ class AMPProtocol(amp.AMP):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
sessid, kwargs = loads(packed_data)
|
sessid, kwargs = loads(packed_data)
|
||||||
self.factory.server.sessions.data_in(self.factory.server.sessions[sessid], **kwargs)
|
session = self.factory.server.sessions.get(sessid, None)
|
||||||
|
if session:
|
||||||
|
self.factory.server.sessions.data_in(session, **kwargs)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def send_MsgPortal2Server(self, session, **kwargs):
|
def send_MsgPortal2Server(self, session, **kwargs):
|
||||||
|
|
@ -464,7 +466,9 @@ class AMPProtocol(amp.AMP):
|
||||||
packed_data (str): Pickled data (sessid, kwargs) coming over the wire.
|
packed_data (str): Pickled data (sessid, kwargs) coming over the wire.
|
||||||
"""
|
"""
|
||||||
sessid, kwargs = loads(packed_data)
|
sessid, kwargs = loads(packed_data)
|
||||||
self.factory.portal.sessions.data_out(self.factory.portal.sessions[sessid], **kwargs)
|
session = self.factory.portal.sessions.get(sessid, None)
|
||||||
|
if session:
|
||||||
|
self.factory.portal.sessions.data_out(session, **kwargs)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ def _portal_maintenance():
|
||||||
reason = "Idle timeout exceeded, disconnecting."
|
reason = "Idle timeout exceeded, disconnecting."
|
||||||
for session in [sess for sess in PORTAL_SESSIONS.values()
|
for session in [sess for sess in PORTAL_SESSIONS.values()
|
||||||
if (now - sess.cmd_last) > _IDLE_TIMEOUT]:
|
if (now - sess.cmd_last) > _IDLE_TIMEOUT]:
|
||||||
session.data_out(text=[[reason], {}])
|
session.disconnect(reason=reason)
|
||||||
PORTAL_SESSIONS.disconnect(session)
|
PORTAL_SESSIONS.disconnect(session)
|
||||||
|
|
||||||
if _IDLE_TIMEOUT > 0:
|
if _IDLE_TIMEOUT > 0:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue