Skip to content
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

Socket improvements #505

Closed
wants to merge 5 commits into from
Closed

Socket improvements #505

wants to merge 5 commits into from

Conversation

kherrala
Copy link
Contributor

Most important fix here is to stop processing events if socket is closed during error on handle_read or handle_write. It also seems like previous check for closed socket should not be checking for method parameter fd.

Calling socket.shutdown() was inspired by this:
http://engineering.imvu.com/2014/03/06/charming-python-how-to-actually-close-a-socket-by-calling-shutdown-before-calling-close/

@coveralls
Copy link

Coverage Status

Coverage increased (+0.16%) when pulling 4584329 on kherrala:socket-fix into e27b537 on pika:master.

@gmr
Copy link
Member

gmr commented Apr 29, 2015

I like this, but need to cherry pick stuff since not all of it applies anymore.

I'll credit you but commit the changes directly in my own branch.

@gmr gmr closed this Apr 29, 2015
gmr added a commit that referenced this pull request Apr 29, 2015
This is directly taken from #505 but I could not cleanly merge it due to cleanup and some post-PR refactoring. Thanks @	kherrala
if self.socket:
try:
self.socket.shutdown(socket.SHUT_RDWR)
except socket.error as err:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No point for as err, since err is not used

@vitaly-krugl
Copy link
Member

@kherrala, that's a good point about dependency on garbage-collection. I wasn't aware of this socket subtlety in python. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants