Commit f77344bc authored by Andreas Jung's avatar Andreas Jung

backport of former medusa patches

parent 0713f9b8
# -*- Mode: Python; tab-width: 4 -*-
import socket import socket
import select import select
...@@ -50,18 +49,17 @@ def max_select_sockets(): ...@@ -50,18 +49,17 @@ def max_select_sockets():
sl = [] sl = []
while 1: while 1:
try: try:
s = socket.socket (socket.AF_INET, socket.SOCK_STREAM) num = len(sl)
s.bind (('',0)) for i in range(1 + len(sl) * 0.05):
s.listen(5) # Increase exponentially.
sl.append (s) s = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
s.bind (('',0))
s.listen(5)
sl.append (s)
select.select(sl,[],[],0) select.select(sl,[],[],0)
except: except:
break break
num = len(sl) - 1
for s in sl: for s in sl:
s.close() s.close()
del sl del sl
return num return num
# -*- Mode: Python; tab-width: 4 -*-
import socket import socket
import select import select
...@@ -50,18 +49,17 @@ def max_select_sockets(): ...@@ -50,18 +49,17 @@ def max_select_sockets():
sl = [] sl = []
while 1: while 1:
try: try:
s = socket.socket (socket.AF_INET, socket.SOCK_STREAM) num = len(sl)
s.bind (('',0)) for i in range(1 + len(sl) * 0.05):
s.listen(5) # Increase exponentially.
sl.append (s) s = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
s.bind (('',0))
s.listen(5)
sl.append (s)
select.select(sl,[],[],0) select.select(sl,[],[],0)
except: except:
break break
num = len(sl) - 1
for s in sl: for s in sl:
s.close() s.close()
del sl del sl
return num return num
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment