2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-29 04:50:21 +00:00

Fix file descriptor leak by web forwarder

It failed to close the two sockets when a socket was
done.
This commit is contained in:
Jarrod Johnson 2021-01-13 16:50:17 -05:00
parent 5160023cc4
commit ebf50359f0

View File

@ -34,6 +34,8 @@ def handle_connection(incoming, outgoing):
for mysock in r:
data = mysock.recv(32768)
if not data:
incoming.close()
outgoing.close()
return
if mysock == incoming:
outgoing.sendall(data)
@ -72,6 +74,7 @@ def forward_video():
vidclient.setsockopt(socket.IPPROTO_TCP, socket.TCP_MAXSEG, 1456)
except Exception:
conn.close()
vidclient.close()
continue
eventlet.spawn_n(handle_connection, conn, vidclient)