gnatsd currently uses a global logger. This can cause some problems
(especially around the config-reload work), but global variables are
also just an anti-pattern in general. The current behavior is
particularly surprising because the global logger is configured through
calls to the Server.
This addresses issue #500 by removing the global logger and making it a
field on Server.
Make sure we do the right thing when no args are presented for an MSG, e.g. MSG <spc>.
Also do not parse at all of this is a client, only valid for routes.
When message is split we need to copy message arguments to avoid
rewriting them with new message. Subject, reply and size were correctly
copied by sid wasn't. That led to dropping some messages in clustered
mode if they were split, and the second part was long enough to overwrite
sid in the original buffer.
race condition:
- a client is closed at the same time as an incoming SUB message occurs.
- the subscription is added to the srv.sl even though the socket is
closed.
- the connection cleanup has already run, so the bad state is never
corrected
- now messages may be forwarded to a client without a connection
- messages will not be forwarded to a router that needs it now, because
processMsg assumes the router already received it