Close fingergw connection handler on input termination
When a connection to the fingergw is terminated with no input, the recv() method returns the empty string after poll returns an event with the input flag set. Handle that case by raising a BrokenPipeError which is already handled by the calling code as a remote hang-up. This has a noticeable impact on the test latency. Change-Id: Ia56c94bc1e764b2f0f8ce3d6994689a3e2f7daff
This commit is contained in:
parent
a0974f9f8c
commit
4109322f1c
|
@ -50,7 +50,11 @@ class BaseFingerRequestHandler(socketserver.BaseRequestHandler):
|
|||
raise Exception("Timeout while waiting for input")
|
||||
for fd, event in poll.poll(timeout):
|
||||
if event & select.POLLIN:
|
||||
buffer += self.request.recv(self.MAX_REQUEST_LEN)
|
||||
x = self.request.recv(self.MAX_REQUEST_LEN)
|
||||
if not x:
|
||||
# This will cause the caller to quietly shut down
|
||||
raise BrokenPipeError
|
||||
buffer += x
|
||||
else:
|
||||
raise Exception("Received error event")
|
||||
if len(buffer) >= self.MAX_REQUEST_LEN:
|
||||
|
|
Loading…
Reference in New Issue