ObjFW  Check-in [d81629fead]

Overview
Comment:Move most of the code for -[close] to OFStreamSocket.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d81629fead5ec4fac8444892ff1225106bc997c49325ba9e81d413a9c8cd4dcc
User & Date: js on 2010-07-07 21:06:20
Other Links: manifest | tags
Context
2010-07-07
21:08
Support for GNU libobjc won't be removed in the near future.
However, ObjFW-RT will be recommended once it's more mature.
check-in: 2924518400 user: js tags: trunk
21:06
Move most of the code for -[close] to OFStreamSocket. check-in: d81629fead user: js tags: trunk
20:57
Rename OFSocket to OFStreamSocket. check-in: 28ea4a8a67 user: js tags: trunk
Changes

Modified src/OFStreamSocket.m from [1c776793df] to [6a144d8c67].

8
9
10
11
12
13
14

15
16
17
18
19
20
21
22
23
24
25
26
27
28




29
30
31
32
33
34
35
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#include "config.h"

#include <string.h>

#include <fcntl.h>
#include <errno.h>

#ifndef _WIN32
# include <sys/types.h>
# include <sys/socket.h>
#endif

#import "OFStreamSocket.h"
#import "OFExceptions.h"

#ifndef INVALID_SOCKET
# define INVALID_SOCKET -1
#endif





@implementation OFStreamSocket
#ifdef _WIN32
+ (void)initialize
{
	WSADATA wsa;








>














>
>
>
>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#include "config.h"

#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>

#ifndef _WIN32
# include <sys/types.h>
# include <sys/socket.h>
#endif

#import "OFStreamSocket.h"
#import "OFExceptions.h"

#ifndef INVALID_SOCKET
# define INVALID_SOCKET -1
#endif

#ifdef _WIN32
# define close(sock) closesocket(sock)
#endif

@implementation OFStreamSocket
#ifdef _WIN32
+ (void)initialize
{
	WSADATA wsa;

120
121
122
123
124
125
126












127
#endif
}

- (int)fileDescriptor
{
	return sock;
}












@end







>
>
>
>
>
>
>
>
>
>
>
>

125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#endif
}

- (int)fileDescriptor
{
	return sock;
}

- (void)close
{
	if (sock == INVALID_SOCKET)
		@throw [OFNotConnectedException newWithClass: isa];

	close(sock);

	sock = INVALID_SOCKET;
	eos = NO;
	listening = NO;
}
@end

Modified src/OFTCPSocket.m from [57db58ad3d] to [9e5de8c85a].

414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434

	/* Get rid of a warning, never reached anyway */
	assert(0);
}

- (void)close
{
	if (sock == INVALID_SOCKET)
		@throw [OFNotConnectedException newWithClass: isa];

	close(sock);
	sock = INVALID_SOCKET;
	listening = NO;
	eos = NO;

	[self freeMemory: sockAddr];
	sockAddr = NULL;
	sockAddrLen = 0;
}

- (void)dealloc







<
<
<
|
<
<
<







414
415
416
417
418
419
420



421



422
423
424
425
426
427
428

	/* Get rid of a warning, never reached anyway */
	assert(0);
}

- (void)close
{



	[super close];




	[self freeMemory: sockAddr];
	sockAddr = NULL;
	sockAddrLen = 0;
}

- (void)dealloc