216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
if (_exception == nil) {
if ([_delegate respondsToSelector:
@selector(socket:didConnectToHost:port:)])
[_delegate socket: _socket
didConnectToHost: _host
port: _port];
} else {
if ([_delegate respondsToSelector:
@selector(stream:didFailWithException:)])
[_delegate stream: _socket
didFailWithException: _exception];
}
#ifdef OF_HAVE_BLOCKS
}
#endif
}
- (void)socketDidConnect: (OFTCPSocket *)sock
|
|
|
|
|
>
>
|
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
if (_exception == nil) {
if ([_delegate respondsToSelector:
@selector(socket:didConnectToHost:port:)])
[_delegate socket: _socket
didConnectToHost: _host
port: _port];
} else {
if ([_delegate respondsToSelector: @selector(socket:
didFailToConnectWithException:host:port:)])
[_delegate socket: _socket
didFailToConnectWithException: _exception
host: _host
port: _port];
}
#ifdef OF_HAVE_BLOCKS
}
#endif
}
- (void)socketDidConnect: (OFTCPSocket *)sock
|
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
|
return 0;
default:
assert(0);
return 0;
}
}
- (void)stream: (OF_KINDOF(OFStream *))sock
didFailWithException: (id)exception
{
_exception = [exception retain];
[self didConnect];
}
@end
@implementation OFTCPSocket_ConnectDelegate
|
|
|
>
>
>
>
>
>
>
|
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
|
return 0;
default:
assert(0);
return 0;
}
}
- (void)stream: (OF_KINDOF(OFStream *))sock
didFailToReadWithException: (id)exception
{
_exception = [exception retain];
[self didConnect];
}
- (void)stream: (OF_KINDOF(OFStream *))sock
didFailToWriteWithException: (id)exception
{
_exception = [exception retain];
[self didConnect];
}
@end
@implementation OFTCPSocket_ConnectDelegate
|
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
|
- (void)socket: (OF_KINDOF(OFTCPSocket *))sock
didConnectToHost: (OFString *)host
port: (uint16_t)port
{
_done = true;
}
- (void)stream: (OF_KINDOF(OFStream *))stream
didFailWithException: (id)exception
{
_done = true;
_exception = [exception retain];
}
@end
@implementation OFTCPSocket
|
|
|
|
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
|
- (void)socket: (OF_KINDOF(OFTCPSocket *))sock
didConnectToHost: (OFString *)host
port: (uint16_t)port
{
_done = true;
}
- (void)socket: (OF_KINDOF(OFTCPSocket *))sock
didFailToConnectWithException: (id)exception
{
_done = true;
_exception = [exception retain];
}
@end
@implementation OFTCPSocket
|