@@ -178,15 +178,16 @@ { #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) int flags; #endif - if (_socket != INVALID_SOCKET) + if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyConnectedException exceptionWithSocket: self]; if ((_socket = socket(address->sockaddr.ipx.sipx_family, - SOCK_SEQPACKET | SOCK_CLOEXEC, NSPROTO_SPX)) == INVALID_SOCKET) { + SOCK_SEQPACKET | SOCK_CLOEXEC, NSPROTO_SPX)) == + OFInvalidSocketHandle) { *errNo = OFSocketErrNo(); return false; } #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) @@ -198,11 +199,11 @@ } - (bool)of_connectSocketToAddress: (const OFSocketAddress *)address errNo: (int *)errNo { - if (_socket == INVALID_SOCKET) + if (_socket == OFInvalidSocketHandle) @throw [OFNotOpenException exceptionWithObject: self]; if (connect(_socket, &address->sockaddr.sockaddr, address->length) != 0) { *errNo = OFSocketErrNo(); @@ -213,11 +214,11 @@ } - (void)of_closeSocket { closesocket(_socket); - _socket = INVALID_SOCKET; + _socket = OFInvalidSocketHandle; } - (void)connectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node network: (uint32_t)network port: (uint16_t)port @@ -314,17 +315,18 @@ OFSocketAddress address; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) int flags; #endif - if (_socket != INVALID_SOCKET) + if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyConnectedException exceptionWithSocket: self]; address = OFSocketAddressMakeIPX(zeroNode, 0, port); if ((_socket = socket(address.sockaddr.sockaddr.sa_family, - SOCK_SEQPACKET | SOCK_CLOEXEC, NSPROTO_SPX)) == INVALID_SOCKET) + SOCK_SEQPACKET | SOCK_CLOEXEC, NSPROTO_SPX)) == + OFInvalidSocketHandle) @throw [OFBindFailedException exceptionWithPort: port packetType: SPX_PACKET_TYPE socket: self errNo: OFSocketErrNo()]; @@ -338,11 +340,11 @@ if (bind(_socket, &address.sockaddr.sockaddr, address.length) != 0) { int errNo = OFSocketErrNo(); closesocket(_socket); - _socket = INVALID_SOCKET; + _socket = OFInvalidSocketHandle; @throw [OFBindFailedException exceptionWithPort: port packetType: SPX_PACKET_TYPE socket: self errNo: errNo]; @@ -355,21 +357,21 @@ if (OFGetSockName(_socket, &address.sockaddr.sockaddr, &address.length) != 0) { int errNo = OFSocketErrNo(); closesocket(_socket); - _socket = INVALID_SOCKET; + _socket = OFInvalidSocketHandle; @throw [OFBindFailedException exceptionWithPort: port packetType: SPX_PACKET_TYPE socket: self errNo: errNo]; } if (address.sockaddr.sockaddr.sa_family != AF_IPX) { closesocket(_socket); - _socket = INVALID_SOCKET; + _socket = OFInvalidSocketHandle; @throw [OFBindFailedException exceptionWithPort: port packetType: SPX_PACKET_TYPE socket: self errNo: EAFNOSUPPORT];