169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
@interface OFRunLoopDatagramSendQueueItem: OFRunLoopQueueItem
{
@public
# ifdef OF_HAVE_BLOCKS
OFDatagramSocketAsyncSendDataBlock _block;
# endif
OFData *_data;
of_socket_address_t _receiver;
}
@end
@interface OFRunLoopPacketReceiveQueueItem: OFRunLoopQueueItem
{
@public
# ifdef OF_HAVE_BLOCKS
|
|
|
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
@interface OFRunLoopDatagramSendQueueItem: OFRunLoopQueueItem
{
@public
# ifdef OF_HAVE_BLOCKS
OFDatagramSocketAsyncSendDataBlock _block;
# endif
OFData *_data;
OFSocketAddress _receiver;
}
@end
@interface OFRunLoopPacketReceiveQueueItem: OFRunLoopQueueItem
{
@public
# ifdef OF_HAVE_BLOCKS
|
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
|
# endif
@end
@implementation OFRunLoopDatagramReceiveQueueItem
- (bool)handleObject: (id)object
{
size_t length;
of_socket_address_t address;
id exception = nil;
@try {
length = [object receiveIntoBuffer: _buffer
length: _length
sender: &address];
} @catch (id e) {
|
|
|
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
|
# endif
@end
@implementation OFRunLoopDatagramReceiveQueueItem
- (bool)handleObject: (id)object
{
size_t length;
OFSocketAddress address;
id exception = nil;
@try {
length = [object receiveIntoBuffer: _buffer
length: _length
sender: &address];
} @catch (id e) {
|
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
|
queueItem->_length = length;
QUEUE_ITEM
}
+ (void)of_addAsyncSendForDatagramSocket: (OFDatagramSocket *)sock
data: (OFData *)data
receiver: (const of_socket_address_t *)receiver
mode: (OFRunLoopMode)mode
# ifdef OF_HAVE_BLOCKS
block: (OFDatagramSocketAsyncSendDataBlock)block
# endif
delegate: (id <OFDatagramSocketDelegate>)delegate
{
NEW_WRITE(OFRunLoopDatagramSendQueueItem, sock, mode)
|
|
|
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
|
queueItem->_length = length;
QUEUE_ITEM
}
+ (void)of_addAsyncSendForDatagramSocket: (OFDatagramSocket *)sock
data: (OFData *)data
receiver: (const OFSocketAddress *)receiver
mode: (OFRunLoopMode)mode
# ifdef OF_HAVE_BLOCKS
block: (OFDatagramSocketAsyncSendDataBlock)block
# endif
delegate: (id <OFDatagramSocketDelegate>)delegate
{
NEW_WRITE(OFRunLoopDatagramSendQueueItem, sock, mode)
|