tm: lock replies before restoring flags for onreply_route
sercmd: read the rest from socket if message was too big for rcv buffer

- reported by Savolainen Dmitri, FS#422