Code cleanup

- limit visibility of pending_connection_t
- add const qualifiers