Overview
Comment: | OFSCTPSocket: Rework blocks-based API |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
b06f8e3e8992a7f2a387c1fedfa859f1 |
User & Date: | js on 2024-10-27 14:07:10 |
Other Links: | manifest | tags |
Context
2024-10-27
| ||
16:14 | OFSequencedPacketSocket: Rework blocks-based API check-in: 776202396c user: js tags: trunk | |
14:07 | OFSCTPSocket: Rework blocks-based API check-in: b06f8e3e89 user: js tags: trunk | |
13:47 | OFDatagramSocket: Rework blocks-based API check-in: 61b5fb53bd user: js tags: trunk | |
Changes
Modified src/OFAsyncIPSocketConnector.h from [45b199b3c1] to [335b6548d5].
︙ | ︙ | |||
34 35 36 37 38 39 40 | @interface OFAsyncIPSocketConnector: OFObject <OFRunLoopConnectDelegate, OFDNSResolverHostDelegate> { id _socket; OFString *_host; uint16_t _port; id _Nullable _delegate; | | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | @interface OFAsyncIPSocketConnector: OFObject <OFRunLoopConnectDelegate, OFDNSResolverHostDelegate> { id _socket; OFString *_host; uint16_t _port; id _Nullable _delegate; id _Nullable _handler; id _Nullable _exception; OFData *_Nullable _socketAddresses; size_t _socketAddressesIndex; } - (instancetype)initWithSocket: (id)sock host: (OFString *)host port: (uint16_t)port delegate: (nullable id)delegate handler: (nullable id)handler; - (void)didConnect; - (void)tryNextAddressWithRunLoopMode: (OFRunLoopMode)runLoopMode; - (void)startWithRunLoopMode: (OFRunLoopMode)runLoopMode; @end OF_ASSUME_NONNULL_END |
Modified src/OFAsyncIPSocketConnector.m from [cdf0c8e6b2] to [b771b2df3c].
︙ | ︙ | |||
34 35 36 37 38 39 40 | #import "OFInvalidFormatException.h" @implementation OFAsyncIPSocketConnector - (instancetype)initWithSocket: (id)sock host: (OFString *)host port: (uint16_t)port delegate: (id)delegate | | | | | | > | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | #import "OFInvalidFormatException.h" @implementation OFAsyncIPSocketConnector - (instancetype)initWithSocket: (id)sock host: (OFString *)host port: (uint16_t)port delegate: (id)delegate handler: (id)handler { self = [super init]; @try { _socket = [sock retain]; _host = [host copy]; _port = port; _delegate = [delegate retain]; _handler = [handler copy]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_socket release]; [_host release]; [_delegate release]; [_handler release]; [_exception release]; [_socketAddresses release]; [super dealloc]; } - (void)didConnect { if (_exception == nil) [_socket setCanBlock: true]; #ifdef OF_HAVE_BLOCKS if (_handler != NULL) { if ([_socket isKindOfClass: [OFTCPSocket class]]) ((OFTCPSocketAsyncConnectBlock)_handler)(_exception); # ifdef OF_HAVE_SCTP else if ([_socket isKindOfClass: [OFSCTPSocket class]]) ((OFSCTPSocketConnectedHandler)_handler)(_socket, _host, _port, _exception); # endif else OFEnsure(0); } else { #endif if ([_delegate respondsToSelector: @selector(socket:didConnectToHost:port:exception:)]) |
︙ | ︙ |
Modified src/OFDatagramSocket.h from [89443d90ed] to [d2615e9e24].
︙ | ︙ | |||
51 52 53 54 55 56 57 | * * @param socket The socket that received a packet * @param buffer The buffer the packet was stored in * @param length The length of the packet * @param sender The address of the sender of the packet * @param exception An exception which occurred while receiving or `nil` on * success | | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | * * @param socket The socket that received a packet * @param buffer The buffer the packet was stored in * @param length The length of the packet * @param sender The address of the sender of the packet * @param exception An exception which occurred while receiving or `nil` on * success * @return A bool whether the same handler should be used for the next receive */ typedef bool (^OFDatagramSocketPacketReceivedHandler)(OFDatagramSocket *socket, void *buffer, size_t length, const OFSocketAddress *_Nonnull sender, id _Nullable exception); /** * @brief A block which is called when a packet has been sent. |
︙ | ︙ | |||
102 103 104 105 106 107 108 | * * @param socket The datagram socket which received a packet * @param buffer The buffer the packet has been written to * @param length The length of the packet * @param sender The address of the sender of the packet * @param exception An exception that occurred while receiving, or nil on * success | | | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | * * @param socket The datagram socket which received a packet * @param buffer The buffer the packet has been written to * @param length The length of the packet * @param sender The address of the sender of the packet * @param exception An exception that occurred while receiving, or nil on * success * @return A bool whether the same handler should be used for the next receive */ - (bool)socket: (OFDatagramSocket *)socket didReceiveIntoBuffer: (void *)buffer length: (size_t)length sender: (const OFSocketAddress *_Nonnull)sender exception: (nullable id)exception; |
︙ | ︙ |
Modified src/OFRunLoop+Private.h from [8d9cb60c01] to [eb31072d96].
︙ | ︙ | |||
139 140 141 142 143 144 145 | delegate: (nullable id <OFSequencedPacketSocketDelegate>)delegate; # ifdef OF_HAVE_SCTP + (void)of_addAsyncReceiveForSCTPSocket: (OFSCTPSocket *)socket buffer: (void *)buffer length: (size_t)length mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS | | | | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | delegate: (nullable id <OFSequencedPacketSocketDelegate>)delegate; # ifdef OF_HAVE_SCTP + (void)of_addAsyncReceiveForSCTPSocket: (OFSCTPSocket *)socket buffer: (void *)buffer length: (size_t)length mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS handler: (nullable OFSCTPSocketMessageReceivedHandler)handler # endif delegate: (nullable id <OFSCTPSocketDelegate>)delegate; + (void)of_addAsyncSendForSCTPSocket: (OFSCTPSocket *)socket data: (OFData *)data info: (OFSCTPMessageInfo)info mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS handler: (nullable OFSCTPSocketDataSentHandler)handler # endif delegate: (nullable id <OFSCTPSocketDelegate>)delegate; # endif + (void)of_cancelAsyncRequestsForObject: (id)object mode: (OFRunLoopMode)mode; #endif - (void)of_removeTimer: (OFTimer *)timer forMode: (OFRunLoopMode)mode; @end |
︙ | ︙ |
Modified src/OFRunLoop.m from [b4516d8680] to [7ce44ca581].
︙ | ︙ | |||
215 216 217 218 219 220 221 | @end # ifdef OF_HAVE_SCTP @interface OFRunLoopSCTPReceiveQueueItem: OFRunLoopQueueItem { @public # ifdef OF_HAVE_BLOCKS | | | | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | @end # ifdef OF_HAVE_SCTP @interface OFRunLoopSCTPReceiveQueueItem: OFRunLoopQueueItem { @public # ifdef OF_HAVE_BLOCKS OFSCTPSocketMessageReceivedHandler _handler; # endif void *_buffer; size_t _length; } @end @interface OFRunLoopSCTPSendQueueItem: OFRunLoopQueueItem { @public # ifdef OF_HAVE_BLOCKS OFSCTPSocketDataSentHandler _handler; # endif OFData *_data; OFSCTPMessageInfo _info; } @end # endif #endif |
︙ | ︙ | |||
1100 1101 1102 1103 1104 1105 1106 | info: &info]; } @catch (id e) { length = 0; exception = e; } # ifdef OF_HAVE_BLOCKS | | | | | 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 | info: &info]; } @catch (id e) { length = 0; exception = e; } # ifdef OF_HAVE_BLOCKS if (_handler != NULL) return _handler(object, _buffer, length, info, exception); else { # endif if (![_delegate respondsToSelector: @selector( socket:didReceiveIntoBuffer:length:info:exception:)]) return false; return [_delegate socket: object didReceiveIntoBuffer: _buffer length: length info: info exception: exception]; # ifdef OF_HAVE_BLOCKS } # endif } # ifdef OF_HAVE_BLOCKS - (void)dealloc { [_handler release]; [super dealloc]; } # endif @end @implementation OFRunLoopSCTPSendQueueItem |
︙ | ︙ | |||
1143 1144 1145 1146 1147 1148 1149 | length: _data.count * _data.itemSize info: _info]; } @catch (id e) { exception = e; } # ifdef OF_HAVE_BLOCKS | | | | 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | length: _data.count * _data.itemSize info: _info]; } @catch (id e) { exception = e; } # ifdef OF_HAVE_BLOCKS if (_handler != NULL) { newData = _handler(object, _data, _info, exception); if (newData == nil) return false; oldData = _data; _data = [newData copy]; [oldData release]; |
︙ | ︙ | |||
1181 1182 1183 1184 1185 1186 1187 | } # endif } - (void)dealloc { # ifdef OF_HAVE_BLOCKS | | | 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 | } # endif } - (void)dealloc { # ifdef OF_HAVE_BLOCKS [_handler release]; # endif [_data release]; [_info release]; [super dealloc]; } @end |
︙ | ︙ | |||
1529 1530 1531 1532 1533 1534 1535 | # endif queueItem->_data = [data copy]; QUEUE_ITEM } # ifdef OF_HAVE_SCTP | > | | | | | | | | | | 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 | # endif queueItem->_data = [data copy]; QUEUE_ITEM } # ifdef OF_HAVE_SCTP + (void) of_addAsyncReceiveForSCTPSocket: (OFSCTPSocket *)sock buffer: (void *)buffer length: (size_t)length mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS handler: (OFSCTPSocketMessageReceivedHandler)handler # endif delegate: (id <OFSCTPSocketDelegate>)delegate { NEW_READ(OFRunLoopSCTPReceiveQueueItem, sock, mode) queueItem->_delegate = [delegate retain]; # ifdef OF_HAVE_BLOCKS queueItem->_handler = [handler copy]; # endif queueItem->_buffer = buffer; queueItem->_length = length; QUEUE_ITEM } + (void)of_addAsyncSendForSCTPSocket: (OFSCTPSocket *)sock data: (OFData *)data info: (OFSCTPMessageInfo)info mode: (OFRunLoopMode)mode # ifdef OF_HAVE_BLOCKS handler: (OFSCTPSocketDataSentHandler)handler # endif delegate: (id <OFSCTPSocketDelegate>)delegate { NEW_WRITE(OFRunLoopSCTPSendQueueItem, sock, mode) queueItem->_delegate = [delegate retain]; # ifdef OF_HAVE_BLOCKS queueItem->_handler = [handler copy]; # endif queueItem->_data = [data copy]; queueItem->_info = [info copy]; QUEUE_ITEM } # endif |
︙ | ︙ |
Modified src/OFSCTPSocket.h from [9bff306013] to [7502e6dc2e].
︙ | ︙ | |||
70 71 72 73 74 75 76 | extern const OFSCTPMessageInfoKey OFSCTPUnordered; #ifdef __cplusplus } #endif #ifdef OF_HAVE_BLOCKS /** | | > > > | > | > > | | > | | > > > | | | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | extern const OFSCTPMessageInfoKey OFSCTPUnordered; #ifdef __cplusplus } #endif #ifdef OF_HAVE_BLOCKS /** * @brief A handler which is called when the socket connected. * * @param socket The socket which connected * @param host The host connected to * @param port The port on the host connected to * @param exception An exception which occurred while connecting the socket or * `nil` on success */ typedef void (^OFSCTPSocketConnectedHandler)(OFSCTPSocket *socket, OFString *host, uint16_t port, id _Nullable exception); /** * @brief A handler which is called when a message has been received. * * @param socket The SCTP socket which received a message * @param buffer The buffer the message has been written to * @param length The length of the message * @param info Information about the message, see @ref OFSCTPMessageInfo * @param exception An exception which occurred while receiving or `nil` on * success * @return A bool whether the same handler should be used for the next receive */ typedef bool (^OFSCTPSocketMessageReceivedHandler)(OFSCTPSocket *socket, void *buffer, size_t length, OFSCTPMessageInfo _Nullable info, id _Nullable exception); /** * @brief A handler which is called when a message has been sent. * * @param socket The SCTP socket which sent a message * @param data The data which was sent * @param info Information about the message, see @ref OFSCTPMessageInfo * @param exception An exception which occurred while reading or `nil` on * success * @return The data to repeat the send with or nil if it should not repeat */ typedef OFData *_Nullable (^OFSCTPSocketDataSentHandler)(OFSCTPSocket *socket, OFData *data, OFSCTPMessageInfo _Nullable info, id _Nullable exception); #endif /** * @protocol OFSCTPSocketDelegate OFSCTPSocket.h ObjFW/ObjFW.h * * A delegate for OFSCTPSocket. */ |
︙ | ︙ | |||
130 131 132 133 134 135 136 | * * @param socket The SCTP socket which received a message * @param buffer The buffer the message has been written to * @param length The length of the message * @param info Information about the message, see @ref OFSCTPMessageInfo * @param exception An exception that occurred while receiving, or nil on * success | | | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | * * @param socket The SCTP socket which received a message * @param buffer The buffer the message has been written to * @param length The length of the message * @param info Information about the message, see @ref OFSCTPMessageInfo * @param exception An exception that occurred while receiving, or nil on * success * @return A bool whether the same handler should be used for the next receive */ - (bool)socket: (OFSCTPSocket *)socket didReceiveIntoBuffer: (void *)buffer length: (size_t)length info: (nullable OFSCTPMessageInfo)info exception: (nullable id)exception; |
︙ | ︙ | |||
220 221 222 223 224 225 226 | #ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously connect the OFSCTPSocket to the specified destination. * * @param host The host to connect to * @param port The port on the host to connect to | | > | | > | | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | #ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously connect the OFSCTPSocket to the specified destination. * * @param host The host to connect to * @param port The port on the host to connect to * @param handler The handler to execute once the connection has been * established */ - (void)asyncConnectToHost: (OFString *)host port: (uint16_t)port handler: (OFSCTPSocketConnectedHandler)handler; /** * @brief Asynchronously connect the OFSCTPSocket to the specified destination. * * @param host The host to connect to * @param port The port on the host to connect to * @param runLoopMode The run loop mode in which to perform the async connect * @param handler The handler to execute once the connection has been * established */ - (void)asyncConnectToHost: (OFString *)host port: (uint16_t)port runLoopMode: (OFRunLoopMode)runLoopMode handler: (OFSCTPSocketConnectedHandler)handler; #endif /** * @brief Bind the socket to the specified host and port. * * @param host The host to bind to. Use `@"0.0.0.0"` for IPv4 or `@"::"` for * IPv6 to bind to all. |
︙ | ︙ | |||
307 308 309 310 311 312 313 | * @brief Asynchronously receives a message and stores it into the specified * buffer. * * If the buffer is too small, the message is truncated. * * @param buffer The buffer to write the message to * @param length The length of the buffer | | | | | | > > | | | | | | | | > > | | | | | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | * @brief Asynchronously receives a message and stores it into the specified * buffer. * * If the buffer is too small, the message is truncated. * * @param buffer The buffer to write the message to * @param length The length of the buffer * @param handler The handler to call when the message has been received. If the * handler returns true, it will be called again with the same * buffer and maximum length when more messages have been * received. If you want the next method in the queue to handle * the message received next, you need to return false from the * method. */ - (void) asyncReceiveWithInfoIntoBuffer: (void *)buffer length: (size_t)length handler: (OFSCTPSocketMessageReceivedHandler)handler; /** * @brief Asynchronously receives a message and stores it into the specified * buffer. * * If the buffer is too small, the message is truncated. * * @param buffer The buffer to write the message to * @param length The length of the buffer * @param runLoopMode The run loop mode in which to perform the asynchronous * receive * @param handler The handler to call when the message has been received. If the * handler returns true, it will be called again with the same * buffer and maximum length when more messages have been * received. If you want the next method in the queue to handle * the message received next, you need to return false from the * method. */ - (void) asyncReceiveWithInfoIntoBuffer: (void *)buffer length: (size_t)length runLoopMode: (OFRunLoopMode)runLoopMode handler: (OFSCTPSocketMessageReceivedHandler)handler; #endif /** * @brief Sends the specified message on the specified stream. * * @param buffer The buffer to send as a message * @param length The length of the buffer |
︙ | ︙ | |||
378 379 380 381 382 383 384 | #ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously sends the specified message on the specified stream. * * @param data The data to send as a message * @param info Information about the message, see @ref OFSCTPMessageInfo | | | | | | | | | | 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | #ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously sends the specified message on the specified stream. * * @param data The data to send as a message * @param info Information about the message, see @ref OFSCTPMessageInfo * @param handler The handler to call when the message has been sent. It should * return the data for the next send with the same callback or * nil if it should not repeat. */ - (void)asyncSendData: (OFData *)data info: (nullable OFSCTPMessageInfo)info handler: (OFSCTPSocketDataSentHandler)handler; /** * @brief Asynchronously sends the specified message on the specified stream. * * @param data The data to send as a message * @param info Information about the message, see @ref OFSCTPMessageInfo * @param runLoopMode The run loop mode in which to perform the asynchronous * send * @param handler The handler to call when the message has been sent. It should * return the data for the next send with the same callback or * nil if it should not repeat. */ - (void)asyncSendData: (OFData *)data info: (nullable OFSCTPMessageInfo)info runLoopMode: (OFRunLoopMode)runLoopMode handler: (OFSCTPSocketDataSentHandler)handler; #endif @end OF_ASSUME_NONNULL_END |
Modified src/OFSCTPSocket.m from [90795d2a22] to [feb16538c8].
︙ | ︙ | |||
201 202 203 204 205 206 207 | @throw [OFAlreadyOpenException exceptionWithObject: self]; [[[[OFAsyncIPSocketConnector alloc] initWithSocket: self host: host port: port delegate: _delegate | | | | | | | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | @throw [OFAlreadyOpenException exceptionWithObject: self]; [[[[OFAsyncIPSocketConnector alloc] initWithSocket: self host: host port: port delegate: _delegate handler: NULL ] autorelease] startWithRunLoopMode: runLoopMode]; objc_autoreleasePoolPop(pool); } #ifdef OF_HAVE_BLOCKS - (void)asyncConnectToHost: (OFString *)host port: (uint16_t)port handler: (OFSCTPSocketConnectedHandler)handler { [self asyncConnectToHost: host port: port runLoopMode: OFDefaultRunLoopMode handler: handler]; } - (void)asyncConnectToHost: (OFString *)host port: (uint16_t)port runLoopMode: (OFRunLoopMode)runLoopMode handler: (OFSCTPSocketConnectedHandler)handler { void *pool = objc_autoreleasePoolPush(); if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; [[[[OFAsyncIPSocketConnector alloc] initWithSocket: self host: host port: port delegate: nil handler: handler] autorelease] startWithRunLoopMode: runLoopMode]; objc_autoreleasePoolPop(pool); } #endif - (OFSocketAddress)bindToHost: (OFString *)host port: (uint16_t)port |
︙ | ︙ | |||
430 431 432 433 434 435 436 | runLoopMode: (OFRunLoopMode)runLoopMode { [OFRunLoop of_addAsyncReceiveForSCTPSocket: self buffer: buffer length: length mode: runLoopMode # ifdef OF_HAVE_BLOCKS | | > | | | | | | | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | runLoopMode: (OFRunLoopMode)runLoopMode { [OFRunLoop of_addAsyncReceiveForSCTPSocket: self buffer: buffer length: length mode: runLoopMode # ifdef OF_HAVE_BLOCKS handler: NULL # endif delegate: _delegate]; } #ifdef OF_HAVE_BLOCKS - (void) asyncReceiveWithInfoIntoBuffer: (void *)buffer length: (size_t)length handler: (OFSCTPSocketMessageReceivedHandler)handler { [self asyncReceiveWithInfoIntoBuffer: buffer length: length runLoopMode: OFDefaultRunLoopMode handler: handler]; } - (void) asyncReceiveWithInfoIntoBuffer: (void *)buffer length: (size_t)length runLoopMode: (OFRunLoopMode)runLoopMode handler: (OFSCTPSocketMessageReceivedHandler)handler { [OFRunLoop of_addAsyncReceiveForSCTPSocket: self buffer: buffer length: length mode: runLoopMode handler: handler delegate: nil]; } #endif - (void)sendBuffer: (const void *)buffer length: (size_t)length { [self sendBuffer: buffer length: length info: nil]; |
︙ | ︙ | |||
534 535 536 537 538 539 540 | runLoopMode: (OFRunLoopMode)runLoopMode { [OFRunLoop of_addAsyncSendForSCTPSocket: self data: data info: info mode: runLoopMode # ifdef OF_HAVE_BLOCKS | | | | | | | 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | runLoopMode: (OFRunLoopMode)runLoopMode { [OFRunLoop of_addAsyncSendForSCTPSocket: self data: data info: info mode: runLoopMode # ifdef OF_HAVE_BLOCKS handler: NULL # endif delegate: _delegate]; } #ifdef OF_HAVE_BLOCKS - (void)asyncSendData: (OFData *)data info: (OFSCTPMessageInfo)info handler: (OFSCTPSocketDataSentHandler)handler { [self asyncSendData: data info: info runLoopMode: OFDefaultRunLoopMode handler: handler]; } - (void)asyncSendData: (OFData *)data info: (OFSCTPMessageInfo)info runLoopMode: (OFRunLoopMode)runLoopMode handler: (OFSCTPSocketDataSentHandler)handler { [OFRunLoop of_addAsyncSendForSCTPSocket: self data: data info: info mode: runLoopMode handler: handler delegate: nil]; } #endif - (void)setCanDelaySendingMessages: (bool)canDelaySendingMessages { int v = !canDelaySendingMessages; |
︙ | ︙ |
Modified src/OFTCPSocket.m from [91624c0cdb] to [aec1aff11b].
︙ | ︙ | |||
240 241 242 243 244 245 246 | delegate = _delegate; [[[[OFAsyncIPSocketConnector alloc] initWithSocket: self host: host port: port delegate: delegate | | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | delegate = _delegate; [[[[OFAsyncIPSocketConnector alloc] initWithSocket: self host: host port: port delegate: delegate handler: NULL ] autorelease] startWithRunLoopMode: runLoopMode]; objc_autoreleasePoolPop(pool); } #ifdef OF_HAVE_BLOCKS - (void)asyncConnectToHost: (OFString *)host |
︙ | ︙ | |||
281 282 283 284 285 286 287 | } [[[[OFAsyncIPSocketConnector alloc] initWithSocket: self host: host port: port delegate: delegate | | | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | } [[[[OFAsyncIPSocketConnector alloc] initWithSocket: self host: host port: port delegate: delegate handler: (delegate == nil ? block : NULL)] autorelease] startWithRunLoopMode: runLoopMode]; objc_autoreleasePoolPop(pool); } #endif - (OFSocketAddress)bindToHost: (OFString *)host port: (uint16_t)port |
︙ | ︙ |