/home/ralf/code/mwlib/async/rpcserver.py:51: DeprecationWarning: gevent.socket.tcp_server is deprecated
socket.tcp_server(self.sock, self.handle_client)
is there a replacement for it? The deprecation warnings have been
introduced in c4c70a465bdc, which doesn't give hints for a replacement.
Regards,
- Ralf
Yeah, it's gone without a replacement. I've deprecated it because it
feels more like an example for how to start implementing your own
accept loop rather than a really useful utility. In particular, it's
missing
- a proper way to shutdown it (if you interrupt it with kill() all the
connections spawned remain active for unlimited time)
- a limit on maximum number of outstanding connections
(Maybe having TCPServer class with those 2 solved would be a good
feature for gevent.)
Also, I might be wrong, but it seems that catching socket.error is no
longer necessary,
so the implementation becomes simply:
def tcp_server(listensocket, server, *args, **kw):
try:
while True:
client_socket = listensocket.accept()
spawn_raw(server, client_socket, *args, **kw)
finally:
listensocket.close()
Regards,
Denis.