tsg: fix segfault

Revert false positive from commit 585d9101b752e4ec525339e5c5addfddb519760d
buffer shouldn't be freed since it is set and used in a stream.
crypto: revert pull request #2130

The fix in #2130 eliminates the problem when connecting over a gateway
but introduces other problems server side and client side (client/server
can't detect anymore when a TCP connection was closed).
transport: handle all return values of tsg_read

tsg_read can also return 0 which means that no data (complete PDU) is
currently available. This case wasn't handled properly.

Fixes #2056
tsg: unwind recursion in tsg_read
tsg: rpc_send_enqueue_pdu always free buffer

rpc_send_enqueue_pdu returns -1 on error but the type of error isn't
distinguishable. Therefore make sure that the buffer gets always freed.
The only exception to this is when the pdu was already queued. Then the
dequeuing function should take care of freeing the buffer when
processing the pdu.
tsg: fix possible free of initialized memory
Merge pull request #2234 from bmiklautz/fix/tls

Transport and tsg fixes