Fixed hang in Device Manager on unexpected connection close
Fixed hang in Device Manager on unexpected connection close

-- Fixed a logic bug in the WeaveDeviceManager C++ class that resulted in the application’s
on-error callback never being called when a connection to a device closed unexpectedly
during a connect or rendezvous operation.  In the observed scenario, a spontaneous close of
a newly established Weave connection just as a security session was starting would result in
the Device Manager ignoring the HandleSessionError() callback from the WeaveSecurityManager,
but only in the case where it had received a HandleConnectionClosed() callback prior to the
HandleSessionError().

The ordering of the two events depends very much on the behavior of the underlying TCP
stack.  Indeed, the situation may only be prevalent on mobile devices, where the network
stack immediately invalidates TCP sockets when there is a change in WiFi/Cellular
connectivity.

The fix was loosen a state check such that the session establishment error is process
correctly regardless of the ordering of the two events.

This fix relates to the problem reported in buganizer issue 135032367.

openweave/openweave-core,openweave/openweave-core,openweave/openweave-core,openweave/openweave-core,openweave/openweave-core,openweave/openweave-core