[jitsi-dev] Detecting closed socket


#1

Hi,
I'm currently writing some test code that verifies that both peers enters TCP_CLOSED state when one of them closes the socket. If the remote peer closes the socket it will set its own state to TCP_CLOSED but the local node will not detect that the socket has been closed. My short debugging of this seems to indicate that the local peer never probes for closed windows because getM_snd_wnd() doesn't return 0 so it never enters if ((getM_snd_wnd() == 0) && (TimeDiff(m_lastsend + m_rx_rto, now) <= 0)). Is this expected behavior? How do I make the local peer detect that the remote peer has called close()?

Regards
Carl


#2

Hey Carl,

The Pseudo TCP proticol does not include a connection ending sequence. It
has to be handled by an external signalling protocol.

In the case of GTalk for example, the recipient would close after the
pre-announced number of bytes have been received.

Emil

--sent from my mobile

···

On Aug 15, 2012 10:30 AM, "Carl Hasselskog" <carl@degoo.com> wrote:

Hi,****

I’m currently writing some test code that verifies that both peers enters
TCP_CLOSED state when one of them closes the socket. If the remote peer
closes the socket it will set its own state to TCP_CLOSED but the local
node will not detect that the socket has been closed. My short debugging of
this seems to indicate that the local peer never probes for closed windows
because getM_snd_wnd() doesn’t return 0 so it never enters if
((getM_snd_wnd() == 0) && (TimeDiff(m_lastsend + m_rx_rto, now) <= 0)). Is
this expected behavior? How do I make the local peer detect that the remote
peer has called close()?****

** **

Regards****

Carl ****

** **


#3

Hi,

···

2012/8/15 Carl Hasselskog <carl@degoo.com>

Hi,****

I'm currently writing some test code that verifies that both peers enters
TCP_CLOSED state when one of them closes the socket. If the remote peer
closes the socket it will set its own state to TCP_CLOSED but the local
node will not detect that the socket has been closed. My short debugging of
this seems to indicate that the local peer never probes for closed windows
because getM_snd_wnd() doesn't return 0 so it never enters if
((getM_snd_wnd() == 0) && (TimeDiff(m_lastsend + m_rx_rto, now) <= 0)). Is
this expected behavior? How do I make the local peer detect that the remote
peer has called close()?****

**

As Emil said there is no closing procedure in Pseudo TCP.
Closed window means that receipent haven't read data from buffer and it
can't receive any more at the moment.
--
Regards, Paweł Domas


#4

Ok, thanks for your quick response! I'll write a background thread that closes connections that have been inactive for x seconds.
Regards
Carl

···

From: Paweł Domas [mailto:paweldomas@gmail.com]

Sent: den 15 augusti 2012 10:43
To: dev@jitsi.java.net
Subject: [jitsi-dev] Re: Detecting closed socket

Hi,
2012/8/15 Carl Hasselskog <carl@degoo.com<mailto:carl@degoo.com>>
Hi,
I'm currently writing some test code that verifies that both peers enters TCP_CLOSED state when one of them closes the socket. If the remote peer closes the socket it will set its own state to TCP_CLOSED but the local node will not detect that the socket has been closed. My short debugging of this seems to indicate that the local peer never probes for closed windows because getM_snd_wnd() doesn't return 0 so it never enters if ((getM_snd_wnd() == 0) && (TimeDiff(m_lastsend + m_rx_rto, now) <= 0)). Is this expected behavior? How do I make the local peer detect that the remote peer has called close()?

As Emil said there is no closing procedure in Pseudo TCP.
Closed window means that receipent haven't read data from buffer and it can't receive any more at the moment.
--
Regards, Paweł Domas