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

Commit

Permalink
Support IPv6 (fixes PyMySQL#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
methane committed Sep 29, 2013
1 parent 7873816 commit 38676f8
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,11 +773,7 @@ def _connect(self):
self.host_info = "Localhost via UNIX socket"
if DEBUG: print('connected using unix_socket')
else:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
t = sock.gettimeout()
sock.settimeout(self.connect_timeout)
sock.connect((self.host, self.port))
sock.settimeout(t)
sock = socket.create_connection((self.host, self.port), self.connect_timeout)
self.host_info = "socket %s:%d" % (self.host, self.port)
if DEBUG: print('connected using socket')
sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
Expand Down

0 comments on commit 38676f8

Please sign in to comment.