Home Bug Reports

handle leak ?句柄泄漏?

run.meirun.mei Member
在下面的函数中

SOCKET
IceInternal::createSocket(bool udp)
{
SOCKET fd;

if(udp)
{
fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
}
else
{
fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
}

if(fd == INVALID_SOCKET)
{
SocketException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
throw ex;
}

#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
//
// Temporary work-around!
// Make this socket non-inheritable, so that IcePack-launched servers
// do not inherit it.
//
if(!SetHandleInformation(reinterpret_cast<HANDLE>(fd), HANDLE_FLAG_INHERIT, 0))
{



////////////////////////////////////////////
handle leak?

SyscallException ex(__FILE__, __LINE__);
ex.error = getSystemErrno();
throw ex;
}
#endif

if(!udp)
{
setTcpNoDelay(fd);
setKeepAlive(fd);
}

return fd;
}

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Thanks for the bug report! We should indeed close the socket here before to throw the Ice::SyscallException. This will be fixed in the next release!

    Benoit.
Sign In or Register to comment.