Skip to content

Return explicitly after close in connect() #1778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion kafka/conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def connect(self):
next_lookup = self._next_afi_sockaddr()
if not next_lookup:
self.close(Errors.KafkaConnectionError('DNS failure'))
return
return self.state
else:
log.debug('%s: creating new socket', self)
self._sock_afi, self._sock_addr = next_lookup
Expand Down Expand Up @@ -409,6 +409,7 @@ def connect(self):
' Disconnecting.', self, ret)
errstr = errno.errorcode.get(ret, 'UNKNOWN')
self.close(Errors.KafkaConnectionError('{} {}'.format(ret, errstr)))
return self.state

# Needs retry
else:
Expand Down Expand Up @@ -442,6 +443,7 @@ def connect(self):
if time.time() > request_timeout + self.last_attempt:
log.error('Connection attempt to %s timed out', self)
self.close(Errors.KafkaConnectionError('timeout'))
return self.state

return self.state

Expand Down