Re: TUnixSystem::CloseConnection

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Mon Feb 28 2000 - 00:53:36 MET


Hi Susan,

  I'll investigate the issue to see if there are no side effects to
removing shutdown().

Cheers, Fons.



On Sun, Feb 27, 2000 at 02:16:10PM -0600, Susan Kasahara wrote:
> Hi ROOTer's,
> I am using the ROOT Networking classes in a parent/child server configuration.
> I've noticed that TUnixSystem::CloseConnection (invoked by TSocket::Close on
> our RH Linux system) uses the Unix "shutdown" function to close the socket
> instead of the "close" function.   The difference is that "close" will not really
> close the socket until the parent/child socket reference count reaches 0 (meaning
> both parent & child have closed the socket), whereas "shutdown" closes the
> socket regardless of the socket reference count.  In a parent/child configuration,
> it's useful to be able to decrement the reference count of the accepted connection
> socket in the parent, but leave the socket open in the child.
> I'm wondering if the "shutdown" call is really necessary, i.e. instead of
> 
> void TUnixSystem::CloseConnection(int sock)
> {
>    // Close socket.
> 
>    if (sock < 0) return;
> 
> #if !defined(R__AIX) || defined(_AIX41) || defined(_AIX43)
>    ::shutdown(sock, 2);
> #endif
> 
>    while (::close(sock) == -1 && GetErrno() == EINTR)
>       ResetErrno();
> }
> 
> the function could be modified to:
> 
> void TUnixSystem::CloseConnection(int sock)
> {
>    // Close socket.
> 
>    if (sock < 0) return;
> 
>    while (::close(sock) == -1 && GetErrno() == EINTR)
>       ResetErrno();
> }
> 
> Thanks for taking the time to look at this.
> Susan Kasahara

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:20 MET