Make last_endpoint attribute of socket object
Merge pull request #599 from hurtonm/master

Minor code refactoring