Skip to content

Commit

Permalink
Also handle ECONNREFUSED on .connect() (report on #392)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lonami committed Jan 8, 2018
1 parent 3c686fe commit 46b088d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion telethon/extensions/tcp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def connect(self, ip, port):
except OSError as e:
# There are some errors that we know how to handle, and
# the loop will allow us to retry
if e.errno in (errno.EBADF, errno.ENOTSOCK, errno.EINVAL):
if e.errno in (errno.EBADF, errno.ENOTSOCK, errno.EINVAL,
errno.ECONNREFUSED):
# Bad file descriptor, i.e. socket was closed, set it
# to none to recreate it on the next iteration
self._socket = None
Expand Down

0 comments on commit 46b088d

Please sign in to comment.