fix the loss bug, clean up a bit

the bug was due to setting the buffer position to 0, and then reading again, which was overwriting
the current header

10819 pts/1    Sl+    0:00 bin/relay udp@localhost:10000 tcp@localhost:10001 -- 39712  w1:39712:0:0
10820 pts/1    Sl+    0:00 bin/relay tcp@localhost:10001 udp@localhost:10002 -- 39712  w1:39712:0:0
10821 pts/1    Sl+    0:00 bin/relay udp@localhost:10002 tcp@localhost:10003 -- 39712  w1:39712:0:0
10828 pts/1    Sl+    0:00 bin/relay tcp@localhost:10003 tcp@localhost:10004 -- 39712  w1:39712:0:0
10829 pts/1    Sl+    0:00 bin/relay tcp@localhost:10004 tcp@localhost:10005 -- 39712  w1:39712:0:0
10833 pts/1    Sl+    0:00 bin/relay tcp@localhost:10005 tcp@localhost:10006 -- 39712  w1:39712:0:0
10840 pts/1    Sl+    0:00 bin/relay tcp@localhost:10006 tcp@localhost:10007 -- 39712  w1:39712:0:0
10843 pts/1    Sl+    0:00 bin/relay tcp@localhost:10007 tcp@localhost:9003 -- 39712  w1:39712:0:0