@@ -23,31 +23,31 @@ #ifdef HAVE_FCNTL_H # include #endif #import "OFSCTPSocket.h" +#import "OFAsyncIPSocketConnector.h" #import "OFDNSResolver.h" #import "OFData.h" #import "OFDate.h" -#import "OFIPSocketAsyncConnector.h" #import "OFRunLoop.h" #import "OFRunLoop+Private.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFString.h" #import "OFThread.h" #import "OFAlreadyConnectedException.h" -#import "OFBindFailedException.h" +#import "OFBindIPSocketFailedException.h" #import "OFGetOptionFailedException.h" #import "OFNotOpenException.h" #import "OFSetOptionFailedException.h" static const OFRunLoopMode connectRunLoopMode = @"OFSCTPSocketConnectRunLoopMode"; -@interface OFSCTPSocket () +@interface OFSCTPSocket () @end @interface OFSCTPSocketConnectDelegate: OFObject { @public @@ -165,11 +165,11 @@ void *pool = objc_autoreleasePoolPush(); if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyConnectedException exceptionWithSocket: self]; - [[[[OFIPSocketAsyncConnector alloc] + [[[[OFAsyncIPSocketConnector alloc] initWithSocket: self host: host port: port delegate: _delegate block: NULL @@ -197,11 +197,11 @@ void *pool = objc_autoreleasePoolPush(); if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyConnectedException exceptionWithSocket: self]; - [[[[OFIPSocketAsyncConnector alloc] + [[[[OFAsyncIPSocketConnector alloc] initWithSocket: self host: host port: port delegate: nil block: block] autorelease] @@ -227,16 +227,16 @@ socketAddresses = [[OFThread DNSResolver] resolveAddressesForHost: host addressFamily: OFSocketAddressFamilyAny]; address = *(OFSocketAddress *)[socketAddresses itemAtIndex: 0]; - OFSocketAddressSetPort(&address, port); + OFSocketAddressSetIPPort(&address, port); if ((_socket = socket( ((struct sockaddr *)&address.sockaddr)->sa_family, SOCK_STREAM | SOCK_CLOEXEC, IPPROTO_SCTP)) == OFInvalidSocketHandle) - @throw [OFBindFailedException + @throw [OFBindIPSocketFailedException exceptionWithHost: host port: port socket: self errNo: OFSocketErrNo()]; @@ -255,14 +255,14 @@ int errNo = OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; - @throw [OFBindFailedException exceptionWithHost: host - port: port - socket: self - errNo: errNo]; + @throw [OFBindIPSocketFailedException exceptionWithHost: host + port: port + socket: self + errNo: errNo]; } objc_autoreleasePoolPop(pool); if (port > 0) @@ -276,14 +276,14 @@ int errNo = OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; - @throw [OFBindFailedException exceptionWithHost: host - port: port - socket: self - errNo: errNo]; + @throw [OFBindIPSocketFailedException exceptionWithHost: host + port: port + socket: self + errNo: errNo]; } switch (((struct sockaddr *)&address.sockaddr)->sa_family) { case AF_INET: return OFFromBigEndian16(address.sockaddr.in.sin_port); @@ -293,14 +293,15 @@ # endif default: closesocket(_socket); _socket = OFInvalidSocketHandle; - @throw [OFBindFailedException exceptionWithHost: host - port: port - socket: self - errNo: EAFNOSUPPORT]; + @throw [OFBindIPSocketFailedException + exceptionWithHost: host + port: port + socket: self + errNo: EAFNOSUPPORT]; } } - (void)setCanDelaySendingPackets: (bool)canDelaySendingPackets {