Fix #2758.

The problem turned out to be a typo. In certain cases, sync_from() would throw sync_failed_exc_t even if a peer was connected, instead of waiting for metadata from the peer.

I also fixed a couple of minor style issues.

This has been reviewed by @danielmewes.