Return pipe from connection routine even on failure as it is used elsewhere.
Pass in correct parameters to packet_header generator. This caused an exception which disconnected the pipe.