ObjFW  Check-in [df7f59b26c]

Overview
Comment:Rename OFListen{ -> OnSocket}FailedException
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: df7f59b26c13a361831b3120159f096b4348a137d68c878bc26e8ca34d4f9dfe
User & Date: js on 2022-10-22 17:40:27
Other Links: manifest | tags
Context
2022-10-22
18:41
OFSocket: Don't combine port for IP and IPX check-in: a54730b88f user: js tags: trunk
18:21
Merge trunk into branch "appletalk" check-in: ec6ee4c269 user: js tags: appletalk
17:40
Rename OFListen{ -> OnSocket}FailedException check-in: df7f59b26c user: js tags: trunk
17:29
Split OFConnectSocketFailedException in subclasses check-in: 179b60bfb4 user: js tags: trunk
Changes

Modified src/OFSequencedPacketSocket.h from [1b45c3e58d] to [0f03522481].

301
302
303
304
305
306
307
308

309
310
311
312
313
314
315
316

317
318
319
320
321
322
323
301
302
303
304
305
306
307

308
309
310
311
312
313
314
315

316
317
318
319
320
321
322
323







-
+







-
+







		block: (OFSequencedPacketSocketAsyncSendDataBlock)block;
#endif

/**
 * @brief Listen on the socket.
 *
 * @param backlog Maximum length for the queue of pending connections.
 * @throw OFListenFailedException Listening failed
 * @throw OFListenOnSocketFailedException Listening failed
 * @throw OFNotOpenException The socket is not open
 */
- (void)listenWithBacklog: (int)backlog;

/**
 * @brief Listen on the socket.
 *
 * @throw OFListenFailedException Listening failed
 * @throw OFListenOnSocketFailedException Listening failed
 * @throw OFNotOpenException The socket is not open
 */
- (void)listen;

/**
 * @brief Accept an incoming connection.
 *

Modified src/OFSequencedPacketSocket.m from [a23828dd55] to [0b38781929].

34
35
36
37
38
39
40
41

42
43
44
45
46
47
48
34
35
36
37
38
39
40

41
42
43
44
45
46
47
48







-
+







#import "OFRunLoop.h"
#import "OFSocket.h"
#import "OFSocket+Private.h"

#import "OFAcceptSocketFailedException.h"
#import "OFInitializationFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFListenFailedException.h"
#import "OFListenOnSocketFailedException.h"
#import "OFNotOpenException.h"
#import "OFOutOfRangeException.h"
#import "OFReadFailedException.h"
#import "OFSetOptionFailedException.h"
#import "OFWriteFailedException.h"

@implementation OFSequencedPacketSocket
304
305
306
307
308
309
310
311

312
313
314
315
316
317
318
304
305
306
307
308
309
310

311
312
313
314
315
316
317
318







-
+








- (void)listenWithBacklog: (int)backlog
{
	if (_socket == OFInvalidSocketHandle)
		@throw [OFNotOpenException exceptionWithObject: self];

	if (listen(_socket, backlog) == -1)
		@throw [OFListenFailedException
		@throw [OFListenOnSocketFailedException
		    exceptionWithSocket: self
				backlog: backlog
				  errNo: OFSocketErrNo()];

	_listening = true;
}

Modified src/OFStreamSocket.h from [d51bc427f0] to [700ee89673].

102
103
104
105
106
107
108
109

110
111
112
113
114
115
116
117

118
119
120
121
122
123
124
102
103
104
105
106
107
108

109
110
111
112
113
114
115
116

117
118
119
120
121
122
123
124







-
+







-
+







 */
+ (instancetype)socket;

/**
 * @brief Listen on the socket.
 *
 * @param backlog Maximum length for the queue of pending connections.
 * @throw OFListenFailedException Listening failed
 * @throw OFListenOnSocketFailedException Listening failed
 * @throw OFNotOpenException The socket is not open
 */
- (void)listenWithBacklog: (int)backlog;

/**
 * @brief Listen on the socket.
 *
 * @throw OFListenFailedException Listening failed
 * @throw OFListenOnSocketFailedException Listening failed
 * @throw OFNotOpenException The socket is not open
 */
- (void)listen;

/**
 * @brief Accept an incoming connection.
 *

Modified src/OFStreamSocket.m from [bfc59db558] to [efe4f02a49].

30
31
32
33
34
35
36
37

38
39
40
41
42
43
44
30
31
32
33
34
35
36

37
38
39
40
41
42
43
44







-
+







#import "OFRunLoop.h"
#import "OFRunLoop+Private.h"
#import "OFSocket+Private.h"

#import "OFAcceptSocketFailedException.h"
#import "OFInitializationFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFListenFailedException.h"
#import "OFListenOnSocketFailedException.h"
#import "OFNotImplementedException.h"
#import "OFNotOpenException.h"
#import "OFOutOfRangeException.h"
#import "OFReadFailedException.h"
#import "OFSetOptionFailedException.h"
#import "OFWriteFailedException.h"

229
230
231
232
233
234
235
236

237
238
239
240
241
242
243
229
230
231
232
233
234
235

236
237
238
239
240
241
242
243







-
+








- (void)listenWithBacklog: (int)backlog
{
	if (_socket == OFInvalidSocketHandle)
		@throw [OFNotOpenException exceptionWithObject: self];

	if (listen(_socket, backlog) == -1)
		@throw [OFListenFailedException
		@throw [OFListenOnSocketFailedException
		    exceptionWithSocket: self
				backlog: backlog
				  errNo: OFSocketErrNo()];

	_listening = true;
}

Modified src/ObjFW.h from [8723793ddc] to [5fba20607f].

206
207
208
209
210
211
212
213

214
215
216
217
218
219
220
206
207
208
209
210
211
212

213
214
215
216
217
218
219
220







-
+







#import "OFInvalidArgumentException.h"
#import "OFInvalidEncodingException.h"
#import "OFInvalidFormatException.h"
#import "OFInvalidJSONException.h"
#import "OFInvalidServerResponseException.h"
#import "OFLinkItemFailedException.h"
#ifdef OF_HAVE_SOCKETS
# import "OFListenFailedException.h"
# import "OFListenOnSocketFailedException.h"
#endif
#ifdef OF_HAVE_PLUGINS
# import "OFLoadPluginFailedException.h"
#endif
#import "OFLockFailedException.h"
#import "OFMalformedXMLException.h"
#import "OFMoveItemFailedException.h"

Modified src/exceptions/Makefile from [3ffa6b7f15] to [edd87f5594].

57
58
59
60
61
62
63
64

65
66
67
68
69
70
71
57
58
59
60
61
62
63

64
65
66
67
68
69
70
71







-
+







	       OFAlreadyConnectedException.m		\
	       OFBindIPSocketFailedException.m		\
	       OFBindSocketFailedException.m		\
	       OFConnectIPSocketFailedException.m	\
	       OFConnectSocketFailedException.m		\
	       OFDNSQueryFailedException.m		\
	       OFHTTPRequestFailedException.m		\
	       OFListenFailedException.m		\
	       OFListenOnSocketFailedException.m	\
	       OFObserveKernelEventsFailedException.m	\
	       OFResolveHostFailedException.m		\
	       OFTLSHandshakeFailedException.m		\
	       ${USE_SRCS_IPX}				\
	       ${USE_SRCS_UNIX_SOCKETS}
SRCS_IPX = OFBindIPXSocketFailedException.m	\
	   OFConnectSPXSocketFailedException.m

Renamed and modified src/exceptions/OFListenFailedException.h [a41aaff3ca] to src/exceptions/OFListenOnSocketFailedException.h [98d11c8685].

18
19
20
21
22
23
24
25
26



27
28
29
30

31
32
33
34

35
36
37
38
39
40
41
18
19
20
21
22
23
24


25
26
27
28
29
30

31
32
33
34

35
36
37
38
39
40
41
42







-
-
+
+
+



-
+



-
+







#ifndef OF_HAVE_SOCKETS
# error No sockets available!
#endif

OF_ASSUME_NONNULL_BEGIN

/**
 * @class OFListenFailedException \
 *	  OFListenFailedException.h ObjFW/OFListenFailedException.h
 * @class OFListenOnSocketFailedException \
 *	  OFListenOnSocketFailedException.h \
 *	  ObjFW/OFListenOnSocketFailedException.h
 *
 * @brief An exception indicating that listening on the socket failed.
 */
@interface OFListenFailedException: OFException
@interface OFListenOnSocketFailedException: OFException
{
	id _socket;
	int _backlog, _errNo;
	OF_RESERVE_IVARS(OFListenFailedException, 4)
	OF_RESERVE_IVARS(OFListenOnSocketFailedException, 4)
}

/**
 * @brief The socket which failed to listen.
 */
@property (readonly, nonatomic) id socket;

Renamed and modified src/exceptions/OFListenFailedException.m [81694d22f0] to src/exceptions/OFListenOnSocketFailedException.m [5b45bde80b].

11
12
13
14
15
16
17
18

19
20
21

22
23
24
25
26
27
28
11
12
13
14
15
16
17

18
19
20

21
22
23
24
25
26
27
28







-
+


-
+







 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#import "OFListenFailedException.h"
#import "OFListenOnSocketFailedException.h"
#import "OFString.h"

@implementation OFListenFailedException
@implementation OFListenOnSocketFailedException
@synthesize socket = _socket, backlog = _backlog, errNo = _errNo;

+ (instancetype)exception
{
	OF_UNRECOGNIZED_SELECTOR
}