ObjFW  Check-in [d776cbf5e2]

Overview
Comment:Move ivar listening to OFTCPSocket.
Also, we don't need these ivars to be @public anymore.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d776cbf5e2778f65638eb562a9e9f4840622c9a9cf49c03581fa0a3d903bbd7a
User & Date: js on 2011-04-06 18:30:13
Other Links: manifest | tags
Context
2011-04-06
18:35
This ivar does not need to be @public anymore as well. check-in: d9c7249304 user: js tags: trunk
18:30
Move ivar listening to OFTCPSocket.
Also, we don't need these ivars to be @public anymore.
check-in: d776cbf5e2 user: js tags: trunk
2011-04-04
23:32
Remove now useless defines of _GNU_SOURCE. check-in: 93fee7265f user: js tags: trunk
Changes

Modified src/OFStreamSocket.h from [c9f65fae9e] to [a4e5ea7f23].

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#endif

/**
 * \brief A class which provides functions to create and use stream sockets.
 */
@interface OFStreamSocket: OFStream
{
@public
#ifndef _WIN32
	int    sock;
#else
	SOCKET sock;
#endif
	BOOL   listening;
/* Work around a bug in gcc 4.4.4 (possibly only on Haiku) */
#if !defined(__GNUC__) || __GNUC__ != 4 || __GNUC_MINOR__ != 4 || \
    __GNUC_PATCHLEVEL__ != 4
@protected
#endif
	BOOL   eos;
}

/**
 * \return A new autoreleased OFTCPSocket
 */
+ socket;
@end







<
<
|
<
<
<
<
<
<
<
<
<
|







24
25
26
27
28
29
30


31









32
33
34
35
36
37
38
39
#endif

/**
 * \brief A class which provides functions to create and use stream sockets.
 */
@interface OFStreamSocket: OFStream
{


	int  sock;









	BOOL eos;
}

/**
 * \return A new autoreleased OFTCPSocket
 */
+ socket;
@end

Modified src/OFStreamSocket.m from [2a532fea1c] to [f8648491b3].

155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
		@throw [OFNotConnectedException newWithClass: isa
						      socket: self];

	close(sock);

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

- (void)dealloc
{
	if (sock != INVALID_SOCKET)
		[self close];

	[super dealloc];
}
@end







<










155
156
157
158
159
160
161

162
163
164
165
166
167
168
169
170
171
		@throw [OFNotConnectedException newWithClass: isa
						      socket: self];

	close(sock);

	sock = INVALID_SOCKET;
	eos = NO;

}

- (void)dealloc
{
	if (sock != INVALID_SOCKET)
		[self close];

	[super dealloc];
}
@end

Modified src/OFTCPSocket.h from [146d82e777] to [2a976521af].

32
33
34
35
36
37
38

39
40
41
42
43
44
45
 * \brief A class which provides functions to create and use TCP sockets.
 *
 * To connect to a server, create a socket and connect it.
 * To create a server, create a socket, bind it and listen on it.
 */
@interface OFTCPSocket: OFStreamSocket
{

	struct sockaddr	*sockAddr;
	socklen_t	sockAddrLen;
}

/**
 * Connect the OFTCPSocket to the specified destination.
 *







>







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 * \brief A class which provides functions to create and use TCP sockets.
 *
 * To connect to a server, create a socket and connect it.
 * To create a server, create a socket, bind it and listen on it.
 */
@interface OFTCPSocket: OFStreamSocket
{
	BOOL		listening;
	struct sockaddr	*sockAddr;
	socklen_t	sockAddrLen;
}

/**
 * Connect the OFTCPSocket to the specified destination.
 *

Modified src/OFTCPSocket.m from [5e6306097e] to [1a33b199d0].

429
430
431
432
433
434
435

436
437
438
439
440
	assert(0);
}

- (void)close
{
	[super close];


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







>





429
430
431
432
433
434
435
436
437
438
439
440
441
	assert(0);
}

- (void)close
{
	[super close];

	listening = NO;
	[self freeMemory: sockAddr];
	sockAddr = NULL;
	sockAddrLen = 0;
}
@end