Skip to content

Commit

Permalink
Small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
danijar committed Sep 17, 2024
1 parent f7a26d0 commit df1c1f8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion portal/client_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ def _connect(self):
port = int(port)
addr = (host, port, 0, 0) if self.options.ipv6 else (host, port)
sock = self._create()
start = time.time()
error = None
try:
sock.settimeout(10)
Expand Down
6 changes: 4 additions & 2 deletions portal/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,16 @@ def _loop(self):
data = job.result()
if job.postfn:
data, info = data
else:
job.active.release()
del info
data = packlib.pack(data)
status = int(0).to_bytes(8, 'little', signed=False)
self.socket.send(job.addr, job.reqnum, status, *data)
self.metrics['send'] += 1
except Exception as e:
self._error(job.addr, job.reqnum, 4, f'Error in server method: {e}')
finally:
if not job.postfn:
job.active.release()
if completed:
while self.postfn_inp and self.postfn_inp[0].done():
job = self.postfn_inp.popleft()
Expand Down
2 changes: 1 addition & 1 deletion portal/server_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self, port, name='Server', **kwargs):
self._log(f'Binding to {self.addr[0]}:{self.addr[1]}')
self.sock.bind(self.addr)
self.sock.setblocking(False)
self.sock.listen()
self.sock.listen(8192)
self.sel = selectors.DefaultSelector()
self.sel.register(self.sock, selectors.EVENT_READ, data=None)
self._log(f'Listening at {self.addr[0]}:{self.addr[1]}')
Expand Down

0 comments on commit df1c1f8

Please sign in to comment.