51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
sock = INVALID_SOCKET;
saddr = NULL;
return self;
}
- (void)dealloc
{
if (sock != INVALID_SOCKET)
close(sock);
[super dealloc];
}
- connectToService: (OFString*)service
onNode: (OFString*)node
{
if (sock != INVALID_SOCKET)
@throw [OFAlreadyConnectedException newWithClass: isa];
#ifdef HAVE_THREADSAFE_GETADDRINFO
|
<
<
<
<
<
<
<
<
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
sock = INVALID_SOCKET;
saddr = NULL;
return self;
}
- connectToService: (OFString*)service
onNode: (OFString*)node
{
if (sock != INVALID_SOCKET)
@throw [OFAlreadyConnectedException newWithClass: isa];
#ifdef HAVE_THREADSAFE_GETADDRINFO
|
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
|
}
- close
{
if (sock == INVALID_SOCKET)
@throw [OFNotConnectedException newWithClass: isa];
[self freeMemory: saddr];
sock = INVALID_SOCKET;
saddr = NULL;
saddr_len = 0;
return self;
}
@end
|
|
>
>
>
>
>
>
>
>
>
>
|
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
|
}
- close
{
if (sock == INVALID_SOCKET)
@throw [OFNotConnectedException newWithClass: isa];
close(sock);
sock = INVALID_SOCKET;
[self freeMemory: saddr];
saddr = NULL;
saddr_len = 0;
return self;
}
- (void)dealloc
{
if (sock != INVALID_SOCKET)
[self close];
[super dealloc];
}
@end
|