[ggo-discussion] Re: Weird disconnections - IGS?

  • From: Peter Strempel <zotan@xxxxxx>
  • To: ggo-discussion@xxxxxxxxxxxxx
  • Date: Tue, 20 May 2003 22:55:43 +0200


Quite strange. This didn't happen to me lately, but I was not online on IGS
much, so this comment isn't too meaningful.

The gGo code for establishing, maintaining and ending the connection has not
changed since several versions.

A lost connection is basically detected if the stream to IGS is broken. Then
this is handled by giving the user this "Connection closed" dialog and
resetting the client to "disconnected" state.

The code for this is very easy. In Java pseudocode:

try {
  while (true) {
    input = telnet_stream.readLine())
    parse(input);
  }
} catch (IOException) {
  we_have_disconnected();
}

This is textbook code, nothing special.

If IGS does not send input but the connection is still active, this will
block in the readLine() function and continue once there is some more input.
The whole thing runs in an own thread. However, if the stream is interrupted
and the socket is closed (network down, IGS down, IGS disconnected, etc.),
then the exception is raised and gGo cleans up and notifies the user about
the disconnection.

So far I did not touch this code for months. Quite unlikely the reason is in
gGo. However, IGS now runs on Windows, which has the habit of keeping
sockets open for a little longer than the stream. That might be a possible
reason, but this is just a very rough guess.

To sum it up, I have no clue. :)

 Peter

Other related posts: