ObjFW  Diff

Differences From Artifact [4835d59f11]:

To Artifact [014fa32cf3]:


149
150
151
152
153
154
155
156
157
158



159
160
161
162
163
164
165
166
167
168
169
170
171



172
173
174
175
176
177
178
179
149
150
151
152
153
154
155



156
157
158

159
160
161
162
163
164
165
166
167



168
169
170

171
172
173
174
175
176
177







-
-
-
+
+
+
-









-
-
-
+
+
+
-







}

- listenWithBackLog: (int)backlog
{
	if (sock < 0)
		@throw [OFNotConnectedException newWithObject: self];

	if (listen(sock, backlog) < 0 ) {
		/* FIXME: Throw exception */
		return nil;
	if (listen(sock, backlog) < 0)
		@throw [OFListenFailedException newWithObject: self
						   andBackLog: backlog];
	}

	return self;
}

- listen
{
	if (sock < 0)
		@throw [OFNotConnectedException newWithObject: self];

	if (listen(sock, 5) < 0 ) {
		/* FIXME: Throw exception */
		return nil;
	if (listen(sock, 5) < 0)
		@throw [OFListenFailedException newWithObject: self
						   andBackLog: 5];
	}

	return self;
}

- (OFTCPSocket*)accept
{
	OFTCPSocket *newsock;
188
189
190
191
192
193
194

195

196
197
198
199
200
201
202
203
186
187
188
189
190
191
192
193

194

195
196
197
198
199
200
201







+
-
+
-







		addr = [newsock getMemWithSize: sizeof(struct sockaddr)];
	} @catch(id e) {
		[newsock free];
		@throw e;
	}

	if ((s = accept(sock, addr, &addrlen)) < 0) {
		[newsock free];
		/* FIXME: Throw exception */
		@throw [OFAcceptFailedException newWithObject: self];
		return nil;
	}

	[newsock setSocket: s];
	[newsock setSocketAddress: addr
		       withLength: addrlen];

	return newsock;