ObjFW  Check-in [baa6951ec0]

Overview
Comment:OFTCPSocket: Fix a bug in -[accept].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: baa6951ec0eeb5806e43462a2c9c8b1c98cd3c020d3c4177c00202c0d526b332
User & Date: js on 2012-12-11 12:12:33
Original User & Date: js on 2012-12-11 12:12:34
Other Links: manifest | tags
Context
2012-12-11
12:12
OFURL: Add +[URL]. check-in: 12a4d43f67 user: js tags: trunk
12:12
OFTCPSocket: Fix a bug in -[accept]. check-in: baa6951ec0 user: js tags: trunk
12:12
OFTCPSocket: Use a backlog of SOMAXCONN. check-in: d39260c358 user: js tags: trunk
Changes

Modified src/OFTCPSocket.m from [637568184e] to [41e77c8735].

614
615
616
617
618
619
620
621
622
623

624
625
626
627

628
629
630

631
632
633
634
635
636
637
638
639
640
641
614
615
616
617
618
619
620



621




622

623

624

625
626

627
628
629
630
631
632
633







-
-
-
+
-
-
-
-
+
-

-
+
-


-







	OFTCPSocket *newSocket;
	struct sockaddr_storage *addr;
	socklen_t addrLen;
	int newSock;

	newSocket = [[[[self class] alloc] init] autorelease];
	addrLen = sizeof(*addr);

	@try {
		addr = [newSocket allocMemoryWithSize: addrLen];
	addr = [newSocket allocMemoryWithSize: addrLen];
	} @catch (id e) {
		[newSocket release];
		@throw e;
	}


	if ((newSock = accept(sock, (struct sockaddr*)addr,
	    &addrLen)) == INVALID_SOCKET) {
	    &addrLen)) == INVALID_SOCKET)
		[newSocket release];
		@throw [OFAcceptFailedException exceptionWithClass: [self class]
							    socket: self];
	}

	newSocket->sock = newSock;
	newSocket->sockAddr = addr;
	newSocket->sockAddrLen = addrLen;

	return newSocket;
}