Skip to content

Commit

Permalink
Merge pull request tornadoweb#1821 from lilydjwg/master
Browse files Browse the repository at this point in the history
tcpclient: try next address when protocol not supported
  • Loading branch information
bdarnell authored Sep 11, 2016
2 parents 9d76ab9 + e40b89a commit f6dc968
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tornado/tcpclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,13 @@ def connect(self, host, port, af=socket.AF_UNSPEC, ssl_options=None,
def _create_stream(self, max_buffer_size, af, addr):
# Always connect in plaintext; we'll convert to ssl if necessary
# after one connection has completed.
stream = IOStream(socket.socket(af),
io_loop=self.io_loop,
max_buffer_size=max_buffer_size)
return stream.connect(addr)
try:
stream = IOStream(socket.socket(af),
io_loop=self.io_loop,
max_buffer_size=max_buffer_size)
except socket.error as e:
fu = Future()
fu.set_exception(e)
return fu
else:
return stream.connect(addr)

0 comments on commit f6dc968

Please sign in to comment.