Code cleanup

- limit visibility of pending_connection_t
- add const qualifiers
Merge pull request #1053 from hurtonm/master

Code cleanup