apcera/gnatsd — pull request #49 by zrob (2014-09-18 16:31:52+00:00)
Title: Fix subscription sharing/route reconnect race that causes some clients not to receive messages

No longer add subscriptions to router clients with no existing connection.

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