Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Commit

Permalink
#184 add SO_KEEPALIVE to longpoll as a workaround for dead connections
Browse files Browse the repository at this point in the history
Signed-off-by: John Smith <mrdoctorwho@gmail.com>
  • Loading branch information
mrDoctorWho committed Apr 2, 2017
1 parent 5a4acdd commit 484ee51
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion library/longpoll.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ def __add(cls, user):
opener = user.vk.makePoll()
debug("longpoll: user has been added to poll (jid: %s)", user.source)
if opener:
cls.__list[opener.sock] = (user, opener)
sock = opener.sock
sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
cls.__list[sock] = (user, opener)
return opener
logger.warning("longpoll: got null opener! (jid: %s)", user.source)
cls.__addToBuffer(user)
Expand Down

0 comments on commit 484ee51

Please sign in to comment.