Overview
Comment: | OFUDPSocket: Allow specifying the run loop mode |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
b90d4055a120dc8cda832b2c17af2471 |
User & Date: | js on 2018-09-29 14:45:50 |
Other Links: | manifest | tags |
Context
2018-10-06
| ||
13:52 | OFDNSResolver: Allow specifying the run loop mode check-in: 7efb3c590e user: js tags: trunk | |
2018-09-29
| ||
14:45 | OFUDPSocket: Allow specifying the run loop mode check-in: b90d4055a1 user: js tags: trunk | |
2018-09-24
| ||
22:14 | OFStream: Allow specifying the run loop mode check-in: cf93ca4b21 user: js tags: trunk | |
Changes
Modified src/OFUDPSocket.h from [ad5fd6fb30] to [29dec683be].
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" #import "OFKernelEventObserver.h" #import "socket.h" OF_ASSUME_NONNULL_BEGIN /*! @file */ | > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" #import "OFKernelEventObserver.h" #import "OFRunLoop.h" #import "socket.h" OF_ASSUME_NONNULL_BEGIN /*! @file */ |
︙ | ︙ | |||
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 248 249 | */ - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length target: (id)target selector: (SEL)selector context: (nullable id)context; #ifdef OF_HAVE_BLOCKS /*! * @brief Asynchronously receives a datagram and stores it into the specified * buffer. * * If the buffer is too small, the datagram is truncated. * * @param buffer The buffer to write the datagram to * @param length The length of the buffer * @param block The block to call when the datagram has been received. If the * block returns true, it will be called again with the same * buffer and maximum length when more datagrams have been * received. If you want the next method in the queue to handle * the datagram received next, you need to return false from the * method. */ - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length block: (of_udp_socket_async_receive_block_t)block; #endif /*! * @brief Sends the specified datagram to the specified address. * * @param buffer The buffer to send as a datagram * @param length The length of the buffer | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | */ - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length target: (id)target selector: (SEL)selector context: (nullable id)context; /*! * @brief Asynchronously receives a datagram and stores it into the specified * buffer. * * If the buffer is too small, the datagram is truncated. * * @param buffer The buffer to write the datagram to * @param length The length of the buffer * @param runLoopMode The run loop mode in which to perform the async receive * @param target The target on which the selector should be called when the * datagram has been received. If the method returns true, it * will be called again with the same buffer and maximum length * when more datagrams have been received. If you want the next * method in the queue to handle the datagram received next, you * need to return false from the method. * @param selector The selector to call on the target. The signature must be * `bool (OFUDPSocket *socket, void *buffer, size_t length, * of_socket_address_t sender, id context, id exception)`. * @param context A context object to pass along to the target */ - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length runLoopMode: (of_run_loop_mode_t)runLoopMode target: (id)target selector: (SEL)selector context: (nullable id)context; #ifdef OF_HAVE_BLOCKS /*! * @brief Asynchronously receives a datagram and stores it into the specified * buffer. * * If the buffer is too small, the datagram is truncated. * * @param buffer The buffer to write the datagram to * @param length The length of the buffer * @param block The block to call when the datagram has been received. If the * block returns true, it will be called again with the same * buffer and maximum length when more datagrams have been * received. If you want the next method in the queue to handle * the datagram received next, you need to return false from the * method. */ - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length block: (of_udp_socket_async_receive_block_t)block; /*! * @brief Asynchronously receives a datagram and stores it into the specified * buffer. * * If the buffer is too small, the datagram is truncated. * * @param buffer The buffer to write the datagram to * @param length The length of the buffer * @param runLoopMode The run loop mode in which to perform the async receive * @param block The block to call when the datagram has been received. If the * block returns true, it will be called again with the same * buffer and maximum length when more datagrams have been * received. If you want the next method in the queue to handle * the datagram received next, you need to return false from the * method. */ - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length runLoopMode: (of_run_loop_mode_t)runLoopMode block: (of_udp_socket_async_receive_block_t)block; #endif /*! * @brief Sends the specified datagram to the specified address. * * @param buffer The buffer to send as a datagram * @param length The length of the buffer |
︙ | ︙ | |||
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | - (void)asyncSendBuffer: (const void *)buffer length: (size_t)length receiver: (of_socket_address_t)receiver target: (id)target selector: (SEL)selector context: (nullable id)context; #ifdef OF_HAVE_BLOCKS /*! * @brief Asynchronously sends the specified datagram to the specified address. * * @param buffer The buffer to send as a datagram * @param length The length of the buffer * @param receiver A pointer to an @ref of_socket_address_t to which the * datagram should be sent * @param block The block to call when the packet has been sent. It should * return the length for the next send with the same callback or 0 * if it should not repeat. The buffer and receiver may be * changed, so that every time a new buffer, length and receiver * can be specified while the callback stays the same. */ - (void)asyncSendBuffer: (const void *)buffer length: (size_t)length receiver: (of_socket_address_t)receiver block: (of_udp_socket_async_send_block_t)block; #endif /*! * @brief Cancels all pending asynchronous requests on the socket. */ - (void)cancelAsyncRequests; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | - (void)asyncSendBuffer: (const void *)buffer length: (size_t)length receiver: (of_socket_address_t)receiver target: (id)target selector: (SEL)selector context: (nullable id)context; /*! * @brief Asynchronously sends the specified datagram to the specified address. * * @param buffer The buffer to send as a datagram * @param length The length of the buffer * @param receiver A pointer to an @ref of_socket_address_t to which the * datagram should be sent * @param runLoopMode The run loop mode in which to perform the async send * @param target The target on which the selector should be called when the * packet has been sent. The method should return the length for * the next send with the same callback or 0 if it should not * repeat. The buffer and receiver may be changed, so that every * time a new buffer, length and receiver can be specified while * the callback stays the same. * @param selector The selector to call on the target. The signature must be * `size_t (OFUDPSocket *socket, const void **buffer, * size_t bytesSent, of_socket_address_t *receiver, id context, * id exception)`. * @param context A context object to pass along to the target */ - (void)asyncSendBuffer: (const void *)buffer length: (size_t)length receiver: (of_socket_address_t)receiver runLoopMode: (of_run_loop_mode_t)runLoopMode target: (id)target selector: (SEL)selector context: (nullable id)context; #ifdef OF_HAVE_BLOCKS /*! * @brief Asynchronously sends the specified datagram to the specified address. * * @param buffer The buffer to send as a datagram * @param length The length of the buffer * @param receiver A pointer to an @ref of_socket_address_t to which the * datagram should be sent * @param block The block to call when the packet has been sent. It should * return the length for the next send with the same callback or 0 * if it should not repeat. The buffer and receiver may be * changed, so that every time a new buffer, length and receiver * can be specified while the callback stays the same. */ - (void)asyncSendBuffer: (const void *)buffer length: (size_t)length receiver: (of_socket_address_t)receiver block: (of_udp_socket_async_send_block_t)block; /*! * @brief Asynchronously sends the specified datagram to the specified address. * * @param buffer The buffer to send as a datagram * @param length The length of the buffer * @param receiver A pointer to an @ref of_socket_address_t to which the * datagram should be sent * @param runLoopMode The run loop mode in which to perform the async send * @param block The block to call when the packet has been sent. It should * return the length for the next send with the same callback or 0 * if it should not repeat. The buffer and receiver may be * changed, so that every time a new buffer, length and receiver * can be specified while the callback stays the same. */ - (void)asyncSendBuffer: (const void *)buffer length: (size_t)length receiver: (of_socket_address_t)receiver runLoopMode: (of_run_loop_mode_t)runLoopMode block: (of_udp_socket_async_send_block_t)block; #endif /*! * @brief Cancels all pending asynchronous requests on the socket. */ - (void)cancelAsyncRequests; |
︙ | ︙ |
Modified src/OFUDPSocket.m from [a374d3e9ed] to [e0fb2ac475].
︙ | ︙ | |||
510 511 512 513 514 515 516 517 518 519 520 | } - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length target: (id)target selector: (SEL)selector context: (id)context { [OFRunLoop of_addAsyncReceiveForUDPSocket: self buffer: buffer length: length | > > > > > > > > > > > > > > > | > > > > > > > > > > > | | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 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 | } - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length target: (id)target selector: (SEL)selector context: (id)context { [self asyncReceiveIntoBuffer: buffer length: length runLoopMode: of_run_loop_mode_default target: target selector: selector context: context]; } - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length runLoopMode: (of_run_loop_mode_t)runLoopMode target: (id)target selector: (SEL)selector context: (id)context { [OFRunLoop of_addAsyncReceiveForUDPSocket: self buffer: buffer length: length mode: runLoopMode target: target selector: selector context: context]; } #ifdef OF_HAVE_BLOCKS - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length block: (of_udp_socket_async_receive_block_t)block { [self asyncReceiveIntoBuffer: buffer length: length runLoopMode: of_run_loop_mode_default block: block]; } - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length runLoopMode: (of_run_loop_mode_t)runLoopMode block: (of_udp_socket_async_receive_block_t)block { [OFRunLoop of_addAsyncReceiveForUDPSocket: self buffer: buffer length: length mode: runLoopMode block: block]; } #endif - (void)sendBuffer: (const void *)buffer length: (size_t)length receiver: (const of_socket_address_t *)receiver |
︙ | ︙ | |||
581 582 583 584 585 586 587 588 589 590 591 592 | - (void)asyncSendBuffer: (const void *)buffer length: (size_t)length receiver: (of_socket_address_t)receiver target: (id)target selector: (SEL)selector context: (id)context { [OFRunLoop of_addAsyncSendForUDPSocket: self buffer: buffer length: length receiver: receiver | > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > | | 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 | - (void)asyncSendBuffer: (const void *)buffer length: (size_t)length receiver: (of_socket_address_t)receiver target: (id)target selector: (SEL)selector context: (id)context { [self asyncSendBuffer: buffer length: length receiver: receiver runLoopMode: of_run_loop_mode_default target: target selector: selector context: context]; } - (void)asyncSendBuffer: (const void *)buffer length: (size_t)length receiver: (of_socket_address_t)receiver runLoopMode: (of_run_loop_mode_t)runLoopMode target: (id)target selector: (SEL)selector context: (id)context { [OFRunLoop of_addAsyncSendForUDPSocket: self buffer: buffer length: length receiver: receiver mode: runLoopMode target: target selector: selector context: context]; } #ifdef OF_HAVE_BLOCKS - (void)asyncSendBuffer: (const void *)buffer length: (size_t)length receiver: (of_socket_address_t)receiver block: (of_udp_socket_async_send_block_t)block { [self asyncSendBuffer: buffer length: length receiver: receiver runLoopMode: of_run_loop_mode_default block: block]; } - (void)asyncSendBuffer: (const void *)buffer length: (size_t)length receiver: (of_socket_address_t)receiver runLoopMode: (of_run_loop_mode_t)runLoopMode block: (of_udp_socket_async_send_block_t)block { [OFRunLoop of_addAsyncSendForUDPSocket: self buffer: buffer length: length receiver: receiver mode: runLoopMode block: block]; } #endif - (void)cancelAsyncRequests { [OFRunLoop of_cancelAsyncRequestsForObject: self |
︙ | ︙ |