tcp: Fix a few problems with the TCP blocking mode.