Comment #4 on issue 765 by nbarrera: JDiameter server doesn't detect that the client has closed connection
http://code.google.com/p/mobicents/issues/detail?id=765

Hi,

Sorry I did a bad report because in fact I found this issue as I tested the sh-server
with an open diameter client, not the java sh-client.

Maybe it's that the sh-client shutdowns it's connection in certain way that sh-server
then prints instantly Read Thread Stopped.

I will test it again with r6820 using the open diameter client I use, in the mean
time please review this code (which was the one I modified for this fix):

//...
             while ( !stop ) {
                 int dataLength = socketChannel.read(buffer);
if (dataLength == -1) { // <-- -1 means the other side has disconnected if (socketChannel.isConnected()) { // <-- isConnected == true means that socket has once been connected..., not necessary is now connected.
                        Thread.sleep(10);
continue; // <-- Executing this will keep running the while
and then not printing the Read Thread Stopped
                    } else {
break; // <-- Executing this then would print Read Thread Stopped
                    }
//...


I suggest that the isConnected method here is misused
(check the link
http://www.velocityreviews.com/forums/t125620-client-socket-disconnection-event-not-received-on-server-socket-java-nio.html
on the first response. "This is not what the isConnected()...")
and in my scenario it only delays the acknowledgment that the client socket has been closed, delaying the Read Thread Stopped print by looping by the continue; branch until... in another thread the DWR timeout is reached and the sh-server tries to send the DWR and an exception is thrown because there it acknowledges that the socket has
been closed, then printint Read Thread Stopped.

Thanks again, I 'll give some feedback to you when i try it again with the r6820,
give me a couple of days :)

cheers

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

Reply via email to