Index: src/OFRunLoop+Private.h ================================================================== --- src/OFRunLoop+Private.h +++ src/OFRunLoop+Private.h @@ -49,11 +49,12 @@ block: (of_stream_async_read_block_t)block; + (void)OF_addAsyncReadLineForStream: (OFStream*)stream encoding: (of_string_encoding_t)encoding block: (of_stream_async_read_line_block_t)block; + (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)socket - block: (of_tcpsocket_async_accept_block_t)block; + block: (of_tcp_socket_async_accept_block_t) + block; # endif + (void)OF_cancelAsyncRequestsForStream: (OFStream*)stream; #endif - (void)OF_removeTimer: (OFTimer*)timer; @end Index: src/OFRunLoop.m ================================================================== --- src/OFRunLoop.m +++ src/OFRunLoop.m @@ -82,11 +82,11 @@ @interface OFRunLoop_AcceptQueueItem: OFRunLoop_QueueItem { @public # ifdef OF_HAVE_BLOCKS - of_tcpsocket_async_accept_block_t _block; + of_tcp_socket_async_accept_block_t _block; # endif } @end @implementation OFRunLoop_QueueItem @@ -270,11 +270,11 @@ queueItem->_encoding = encoding; }) } + (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)stream - block: (of_tcpsocket_async_accept_block_t)block + block: (of_tcp_socket_async_accept_block_t)block { ADD(OFRunLoop_AcceptQueueItem, { queueItem->_block = [block copy]; }) } Index: src/OFTCPSocket.h ================================================================== --- src/OFTCPSocket.h +++ src/OFTCPSocket.h @@ -29,11 +29,11 @@ * * @param socket The socket which connected * @param exception An exception which occurred while connecting the socket or * nil on success */ -typedef void (^of_tcpsocket_async_connect_block_t)(OFTCPSocket *socket, +typedef void (^of_tcp_socket_async_connect_block_t)(OFTCPSocket *socket, OFException *exception); /*! * @brief A block which is called when the socket accepted a connection. * @@ -42,11 +42,11 @@ * @param exception An exception which occurred while accepting the socket or * nil on success * @return A bool whether the same block should be used for the next incoming * connection */ -typedef bool (^of_tcpsocket_async_accept_block_t)(OFTCPSocket *socket, +typedef bool (^of_tcp_socket_async_accept_block_t)(OFTCPSocket *socket, OFTCPSocket *acceptedSocket, OFException *exception); #endif /*! * @brief A class which provides functions to create and use TCP sockets. @@ -161,11 +161,11 @@ * @param port The port on the host to connect to * @param block The block to execute once the connection has been established */ - (void)asyncConnectToHost: (OFString*)host port: (uint16_t)port - block: (of_tcpsocket_async_connect_block_t)block; + block: (of_tcp_socket_async_connect_block_t)block; # endif #endif /*! * @brief Bind the socket to the specified host and port. @@ -218,11 +218,11 @@ * * @param block The block to execute when a new connection has been accepted. * Returns whether the next incoming connection should be accepted * by the specified block as well. */ -- (void)asyncAcceptWithBlock: (of_tcpsocket_async_accept_block_t)block; +- (void)asyncAcceptWithBlock: (of_tcp_socket_async_accept_block_t)block; #endif /*! * @brief Enable or disable keep alives for the connection. * Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -72,11 +72,11 @@ OFString *_host; uint16_t _port; id _target; SEL _selector; # ifdef OF_HAVE_BLOCKS - of_tcpsocket_async_connect_block_t _connectBlock; + of_tcp_socket_async_connect_block_t _connectBlock; # endif OFException *_exception; } - initWithSourceThread: (OFThread*)sourceThread @@ -88,11 +88,11 @@ # ifdef OF_HAVE_BLOCKS - initWithSourceThread: (OFThread*)sourceThread socket: (OFTCPSocket*)socket host: (OFString*)host port: (uint16_t)port - block: (of_tcpsocket_async_connect_block_t)block; + block: (of_tcp_socket_async_connect_block_t)block; # endif @end @implementation OFTCPSocket_ConnectThread - initWithSourceThread: (OFThread*)sourceThread @@ -122,11 +122,11 @@ # ifdef OF_HAVE_BLOCKS - initWithSourceThread: (OFThread*)sourceThread socket: (OFTCPSocket*)socket host: (OFString*)host port: (uint16_t)port - block: (of_tcpsocket_async_connect_block_t)block + block: (of_tcp_socket_async_connect_block_t)block { self = [super init]; @try { _sourceThread = [sourceThread retain]; @@ -331,11 +331,11 @@ } # ifdef OF_HAVE_BLOCKS - (void)asyncConnectToHost: (OFString*)host port: (uint16_t)port - block: (of_tcpsocket_async_connect_block_t)block + block: (of_tcp_socket_async_connect_block_t)block { void *pool = objc_autoreleasePoolPush(); [[[[OFTCPSocket_ConnectThread alloc] initWithSourceThread: [OFThread currentThread] @@ -481,11 +481,11 @@ target: target selector: selector]; } #ifdef OF_HAVE_BLOCKS -- (void)asyncAcceptWithBlock: (of_tcpsocket_async_accept_block_t)block +- (void)asyncAcceptWithBlock: (of_tcp_socket_async_accept_block_t)block { [OFRunLoop OF_addAsyncAcceptForTCPSocket: self block: block]; } #endif