Skip to content
This repository has been archived by the owner on Feb 14, 2020. It is now read-only.

Commit

Permalink
neubot/speedtest.py: Make sure first session's connection is not special
Browse files Browse the repository at this point in the history
The algorithm that maps a connection to the connection's session unique
identifier runs when we have read just the headers.  Therefore the first
connection of a session could not be mapped because at that point the
session does not exist.  But we want to track that connection too.  In
order to do that, this patch adds a special case that register a new
connection if this is the first negotiation of the related session.
  • Loading branch information
bassosimone committed Jan 3, 2011
1 parent 749e371 commit fc72091
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions neubot/speedtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,12 @@ def _speedtest_complete(self, request):
def do_negotiate(self, connection, request, nodelay=False):
session = self.session_negotiate(request)
if session.negotiations == 1:
# XXX make sure we track ALSO the first connection of the
# session (which is assigned an identifier in session_negotiate)
# or, should this connection fail, we would not be able to
# propagate quickly this information because unregister_connection
# would not find an entry in self.connections{}.
self.register_connection(connection, request)
nodelay = True
if not session.active:
if not nodelay:
Expand Down

0 comments on commit fc72091

Please sign in to comment.