[hxcommon] CR - handle connection closure by the server

[hxcommon] CR - handle connection closure by the server

Larry Young lyoung at real.com
Fri Jul 25 13:53:39 PDT 2003


Henry,

Could you please make this (ignoring sigpipe) configurable in netwksvc/hxnetapi.cpp, or move it to a higher level in the client code?  The RBS broadcast functionality in the Producer SDK uses the client network services implementation.  I would to avoid having the RBS plugin dictate which signals are ignored or not at the process level.

Thanks,
Larry

At 11:27 AM 7/25/2003 -0700, Henry Ping wrote:
>Thanks, attached new proposed fix.
>
>As part of the fix, I need to move hxsignal.h from server/common/util/pub/platform/unix to common/util/pub/platform/unix
>
>If no further objection, I will check them in by 2pm today.
>
>-->Henry
>
>At 10:29 PM 7/24/2003 -0700, Dean Collins wrote:
>>Henry,
>>
>>Not all Unix platforms support sigignore().  Others will use someting
>>like signal(SIGPIPE, SIG_IGN).  Still others will want to use sigset().
>>A more portable wrapper is SIGNAL(SIGPIPE, SIG_IGN), defined in
>>common/util/pub/platform/unix/hxsignal.h.
>>
>>However, I'm not convinced this should be happening inside unix_net.cpp
>>at all.  Defining the signal handlers should be happening in the
>>application using this code.  Nowhere else can I find cases where
>>common modules override the application's signal handlers.  That's
>>customarily been the job of the calling application.
>>
>>You should probably just set it in the client's initialization code
>>(using SIGNAL() rather than sigignore()).
>>
>>Dean
>>
>>
>>On Thu, Jul 24, 2003 at 06:42:06PM -0700, Henry Ping wrote:
>>> This is to fix HC issue#474.
>>>
>>> Currently, the server closes the connection after sending alert, the client
>>> receives SIGPIPE in write() on Unix and exits abruptly. After some research
>>> on the net, the proper fix is to ignore the SIGPIPE and check the return
>>> code from write() which we already have and exits the program gracefully.
>>>
>>> If there is no objection, I will check this in to both HEAD and Kittyhawk
>>> tomorrow morning.
>>>
>>> -->Henry
>>> ? a
>>> ? common_netio.dsp
>>> ? common_netio.dsw
>>> ? dbg32
>>> ? Makefile
>>> ? Umakefil.upp
>>> Index: platform/unix/unix_net.cpp
>>> ===================================================================
>>> RCS file: /cvs/common/netio/platform/unix/unix_net.cpp,v
>>> retrieving revision 1.2
>>> diff -u -w -4 -r1.2 unix_net.cpp
>>> --- platform/unix/unix_net.cpp        20 Feb 2003 15:14:09 -0000      1.2
>>> +++ platform/unix/unix_net.cpp        25 Jul 2003 01:31:04 -0000
>>> @@ -52,8 +52,9 @@
>>>  #include <stdio.h>
>>>  #include <stdlib.h>
>>>  #include <string.h>
>>>  #include <unistd.h>
>>> +#include <signal.h>
>>>  #include <assert.h>
>>>  #include "hxcom.h"
>>>  #include "hxbuffer.h"
>>>  #include "timebuff.h"
>>> @@ -109,17 +110,26 @@
>>>       m_anDNSPipe[1] = nInvalidPipe;
>>>       m_nChildProcID = 0;
>>>       m_szPipeIP[0]  = '\0';
>>>
>>> -
>>>       read_pending = FALSE;
>>>       m_lRefCount         = 0;
>>>       m_pInBuffer = new char[TCP_BUF_SIZE];
>>>
>>>       m_bReuseAddr = FALSE;
>>>       m_bReusePort = FALSE;
>>>       m_pAsyncHost = NULL;
>>>
>>> +        // When the connection is closed by the server, SIGPIPE will be thrown
>>> +        // in next write() and terminates the program abruptly.
>>> +        //
>>> +        // In order to gracefully exists the program, it's recommended to:
>>> +        // - ignore the SIGPIPE and
>>> +        // - checks the return code(errno) from write()
>>> +        //
>>> +        // for read(), it simply returns 0 when the connection is closed.
>>> +        sigignore(SIGPIPE);
>>> +
>>>  #ifdef _UNIX_THREADS_SUPPORTED
>>>          m_pResolver  = NULL;
>>>  #endif
>>>  }
>>>
>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe at common.helixcommunity.org
>>> For additional commands, e-mail: dev-help at common.helixcommunity.org
>>
>>--
>>Dean Collins
>>Server Technical Lead, RealNetworks, Inc. -- http://www.realnetworks.com
>>Helix Server Project Owner -- http://helix-server.helixcommunity.org
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: dev-unsubscribe at common.helixcommunity.org
>>For additional commands, e-mail: dev-help at common.helixcommunity.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe at common.helixcommunity.org
>For additional commands, e-mail: dev-help at common.helixcommunity.org 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe at common.helixcommunity.org
For additional commands, e-mail: dev-help at common.helixcommunity.org




More information about the Common-dev mailing list
 

Site Map   |   Terms of Use   |   Privacy Policy   |   Contact Us

Copyright © 1995-2007 RealNetworks, Inc. All rights reserved. RealNetworks and Helix are trademarks of RealNetworks.
All other trademarks or registered trademarks are the property of their respective holders.