Fixed shutdown and cleanup sequence
Updated log date-time format
Tcp socket is now async
Added thread locks
Fixed double locking
Protobuf serializes to ostream instead of string