Various improvements:

* Add logging infrastructure
* Prevent input buffer resize
* Allow a peer to request itself