jaraco / irc

Full-featured Python IRC library for Python.
MIT License
390 stars 84 forks source link

Update client.py #162

Closed trevortaG closed 4 years ago

trevortaG commented 4 years ago

Currently, we encounter "ServerNotConnectedError: Not connected" error when the client tries to ping the server after the connection was closed. With this change, we only send a keepalive if we think we're connected. Otherwise, the client will crash if a keepalive is sent while disconnected.

jaraco commented 4 years ago

I feel like there are some design decisions to be made here. For some clients, it may be desirable to crash if a ping isn't successful (so a supervisor can restart it). If I recall correctly, that's one reason why this function was put in place. Suppressing a ServerNotConnected error would bypass that purpose.

Can you explain more about how you use keep-alive, but want the pings to silently fail?