Differences From Artifact [ac74ecd3ae]:
- File src/OFRunLoop.m — part of check-in [c7f0229795] at 2020-01-02 01:51:34 on branch trunk — Update copyright (user: js, size: 34144) [annotate] [blame] [check-ins using] [more...]
To Artifact [9886e0ee45]:
- File
src/OFRunLoop.m
— part of check-in
[b02c4b05bb]
at
2020-04-25 17:05:13
on branch trunk
— Add OFDatagramSocket as base class for OFUDPSocket
This makes it easier to reuse code for other datagram sockets, namely
IPX. (user: js, size: 34180) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
158 159 160 161 162 163 164 | @public # ifdef OF_HAVE_BLOCKS of_tcp_socket_async_accept_block_t _block; # endif } @end | | | | | | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | @public # ifdef OF_HAVE_BLOCKS of_tcp_socket_async_accept_block_t _block; # endif } @end @interface OFRunLoopDatagramReceiveQueueItem: OFRunLoopQueueItem { @public # ifdef OF_HAVE_BLOCKS of_datagram_socket_async_receive_block_t _block; # endif void *_buffer; size_t _length; } @end @interface OFRunLoopDatagramSendQueueItem: OFRunLoopQueueItem { @public # ifdef OF_HAVE_BLOCKS of_datagram_socket_async_send_data_block_t _block; # endif OFData *_data; of_socket_address_t _receiver; } @end #endif |
︙ | ︙ | |||
768 769 770 771 772 773 774 | [_block release]; [super dealloc]; } # endif @end | | | 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | [_block release]; [super dealloc]; } # endif @end @implementation OFRunLoopDatagramReceiveQueueItem - (bool)handleObject: (id)object { size_t length; of_socket_address_t address; id exception = nil; @try { |
︙ | ︙ | |||
813 814 815 816 817 818 819 | [_block release]; [super dealloc]; } # endif @end | | | 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 | [_block release]; [super dealloc]; } # endif @end @implementation OFRunLoopDatagramSendQueueItem - (bool)handleObject: (id)object { id exception = nil; OFData *newData, *oldData; @try { [object sendBuffer: _data.items |
︙ | ︙ | |||
1078 1079 1080 1081 1082 1083 1084 | # ifdef OF_HAVE_BLOCKS queueItem->_block = [block copy]; # endif QUEUE_ITEM } | | | | | | < | | | | | | | < | | | 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 | # ifdef OF_HAVE_BLOCKS queueItem->_block = [block copy]; # endif QUEUE_ITEM } + (void)of_addAsyncReceiveForDatagramSocket: (OFDatagramSocket *)sock buffer: (void *)buffer length: (size_t)length mode: (of_run_loop_mode_t)mode # ifdef OF_HAVE_BLOCKS block: (of_datagram_socket_async_receive_block_t)block # endif delegate: (id <OFDatagramSocketDelegate>)delegate { NEW_READ(OFRunLoopDatagramReceiveQueueItem, sock, mode) queueItem->_delegate = [delegate retain]; # ifdef OF_HAVE_BLOCKS queueItem->_block = [block copy]; # endif queueItem->_buffer = buffer; queueItem->_length = length; QUEUE_ITEM } + (void)of_addAsyncSendForDatagramSocket: (OFDatagramSocket *)sock data: (OFData *)data receiver: (const of_socket_address_t *)receiver mode: (of_run_loop_mode_t)mode # ifdef OF_HAVE_BLOCKS block: (of_datagram_socket_async_send_data_block_t)block # endif delegate: (id <OFDatagramSocketDelegate>)delegate { NEW_WRITE(OFRunLoopDatagramSendQueueItem, sock, mode) queueItem->_delegate = [delegate retain]; # ifdef OF_HAVE_BLOCKS queueItem->_block = [block copy]; # endif queueItem->_data = [data copy]; queueItem->_receiver = *receiver; |
︙ | ︙ |