Commit b14261dd authored by Antoine Catton's avatar Antoine Catton

Minor: bugfix on equeue in order to support slow requests.

parent 54267e24
...@@ -126,6 +126,8 @@ def main(): ...@@ -126,6 +126,8 @@ def main():
required=False) required=False)
parser.add_argument('-l', '--logfile', nargs=1, required=True, parser.add_argument('-l', '--logfile', nargs=1, required=True,
help="Path to the log file.") help="Path to the log file.")
parser.add_argument('-t', '--timeout', nargs=1, required=False,
dest='timeout', type=int, default=3)
parser.add_argument('socket', help="Path to the unix socket") parser.add_argument('socket', help="Path to the unix socket")
args = parser.parse_args() args = parser.parse_args()
...@@ -171,13 +173,16 @@ def main(): ...@@ -171,13 +173,16 @@ def main():
conn, addr = unixsocket.accept() conn, addr = unixsocket.accept()
logger.debug("Connection with file descriptor %d", conn.fileno()) logger.debug("Connection with file descriptor %d", conn.fileno())
conn.setblocking(False) conn.settimeout(args.timeout)
request_string = StringIO() request_string = StringIO()
segment = None segment = None
while segment != '': try:
segment = conn.recv(1) while segment != '':
request_string.write(segment) segment = conn.recv(1024)
request_string.write(segment)
except socket.timeout:
pass
command = '127' command = '127'
try: try:
......
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