openigtlink/OpenIGTLinkIF — pull request #43 by lassoan (2014-08-19 03:54:25+00:00)
Title: ENH: Prevent continuous changing of connector node state while waiting for connection

This is a fix for big performance issue in PlusRemote: Slicer basically hangs if it is in waiting-for-connection state for a a few minutes because OpenIGTLinkIF constantly changes the state of the connector node while waiting for connection.

Root cause: igtlcon->WaitForConnection() does not delete the socket, just closes it, so (igtlcon->Socket.IsNotNull()) is always true. This causes a STATE_WAIT_CONNECTED and STATE_WAIT_CONNECTION state change at each reconnect attempt, which results unnecessary Modified event invocations.

Instead, (igtlcon->Socket->GetConnected()) should be called to see if a client/server is connected successfully.

Tested on Windows in both client and server modes.