For SSL protocol, the socket will be wrapped inside a SSLSocket instance, and the original socket will be detached, i.e., closed without closing the underlying file description. This leads to -1 socket.fileno inside Epoll selector.
This does not create any problem until https://github.com/wbarnha/kafka-python-ng/pull/156 , which unregisters fd based on socket.fileno.
We can just check key.fd instead of key.fileob.fileno() on top of https://github.com/wbarnha/kafka-python-ng/pull/156, but I think a better solution is to handle SSL socket more gracefully. Having a registered socket with key.fd != key.fileobj.fileno() is error-prone in my opinion.
See issue https://github.com/wbarnha/kafka-python-ng/issues/177
For SSL protocol, the socket will be wrapped inside a SSLSocket instance, and the original socket will be detached, i.e., closed without closing the underlying file description. This leads to -1 socket.fileno inside Epoll selector.
This does not create any problem until https://github.com/wbarnha/kafka-python-ng/pull/156 , which unregisters fd based on socket.fileno.
We can just check
key.fd
instead ofkey.fileob.fileno()
on top of https://github.com/wbarnha/kafka-python-ng/pull/156, but I think a better solution is to handle SSL socket more gracefully. Having a registered socket withkey.fd != key.fileobj.fileno()
is error-prone in my opinion.