Overview
Context
Changes
Modified src/OFTCPSocket.h
from [0fb7f74026]
to [6656d5bf06].
︙ | | |
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
-
+
-
+
|
*/
- (uint16_t)bindToHost: (OFString *)host
port: (uint16_t)port;
/*!
* @brief Listen on the socket.
*
* @param backLog Maximum length for the queue of pending connections.
* @param backlog Maximum length for the queue of pending connections.
*/
- (void)listenWithBackLog: (int)backLog;
- (void)listenWithBacklog: (int)backlog;
/*!
* @brief Listen on the socket.
*/
- (void)listen;
/*!
|
︙ | | |
Modified src/OFTCPSocket.m
from [cc02b954ab]
to [596449d526].
︙ | | |
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
|
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
|
-
+
-
+
-
+
-
+
|
port: port
socket: self
errNo: EAFNOSUPPORT];
}
- (void)listen
{
[self listenWithBackLog: SOMAXCONN];
[self listenWithBacklog: SOMAXCONN];
}
- (void)listenWithBackLog: (int)backLog
- (void)listenWithBacklog: (int)backlog
{
if (_socket == INVALID_SOCKET)
@throw [OFNotOpenException exceptionWithObject: self];
if (listen(_socket, backLog) == -1)
if (listen(_socket, backlog) == -1)
@throw [OFListenFailedException
exceptionWithSocket: self
backLog: backLog
backlog: backlog
errNo: of_socket_errno()];
_listening = true;
}
- (instancetype)accept
{
|
︙ | | |
Modified src/exceptions/OFListenFailedException.h
from [0892bf06fa]
to [ee580e83aa].
︙ | | |
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
-
+
-
+
-
+
-
+
-
+
-
+
|
* OFListenFailedException.h ObjFW/OFListenFailedException.h
*
* @brief An exception indicating that listening on the socket failed.
*/
@interface OFListenFailedException: OFException
{
id _socket;
int _backLog, _errNo;
int _backlog, _errNo;
}
/*!
* @brief The socket which failed to listen.
*/
@property (readonly, nonatomic) id socket;
/*!
* @brief The requested back log.
*/
@property (readonly, nonatomic) int backLog;
@property (readonly, nonatomic) int backlog;
/*!
* @brief The errno of the error that occurred.
*/
@property (readonly, nonatomic) int errNo;
+ (instancetype)exception OF_UNAVAILABLE;
/*!
* @brief Creates a new, autoreleased listen failed exception.
*
* @param socket The socket which failed to listen
* @param backLog The requested size of the back log
* @param backlog The requested size of the back log
* @param errNo The errno of the error that occurred
* @return A new, autoreleased listen failed exception
*/
+ (instancetype)exceptionWithSocket: (id)socket
backLog: (int)backLog
backlog: (int)backlog
errNo: (int)errNo;
- (instancetype)init OF_UNAVAILABLE;
/*!
* @brief Initializes an already allocated listen failed exception
*
* @param socket The socket which failed to listen
* @param backLog The requested size of the back log
* @param backlog The requested size of the back log
* @param errNo The errno of the error that occurred
* @return An initialized listen failed exception
*/
- (instancetype)initWithSocket: (id)socket
backLog: (int)backLog
backlog: (int)backlog
errNo: (int)errNo OF_DESIGNATED_INITIALIZER;
@end
OF_ASSUME_NONNULL_END
|
Modified src/exceptions/OFListenFailedException.m
from [f817afc398]
to [c0166f32f7].
︙ | | |
17
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
17
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
-
+
-
+
-
+
-
+
-
+
-
+
|
#include "config.h"
#import "OFListenFailedException.h"
#import "OFString.h"
@implementation OFListenFailedException
@synthesize socket = _socket, backLog = _backLog, errNo = _errNo;
@synthesize socket = _socket, backlog = _backlog, errNo = _errNo;
+ (instancetype)exception
{
OF_UNRECOGNIZED_SELECTOR
}
+ (instancetype)exceptionWithSocket: (id)socket
backLog: (int)backLog
backlog: (int)backlog
errNo: (int)errNo
{
return [[[self alloc] initWithSocket: socket
backLog: backLog
backlog: backlog
errNo: errNo] autorelease];
}
- (instancetype)init
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithSocket: (id)socket
backLog: (int)backLog
backlog: (int)backlog
errNo: (int)errNo
{
self = [super init];
_socket = [socket retain];
_backLog = backLog;
_backlog = backlog;
_errNo = errNo;
return self;
}
- (void)dealloc
{
[_socket release];
[super dealloc];
}
- (OFString *)description
{
return [OFString stringWithFormat:
@"Failed to listen in socket of type %@ with a back log of %d: %@",
[_socket class], _backLog, of_strerror(_errNo)];
[_socket class], _backlog, of_strerror(_errNo)];
}
@end
|