ObjFW  Check-in [37e165aaf6]

Overview
Comment:OFTCPSocket: Fix a bug in -[accept].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 0.7
Files: files | file ages | folders
SHA3-256: 37e165aaf6fd4e954cd04dbc844c92306fbfac957609d1d5d35480e757d30d31
User & Date: js on 2012-12-11 12:14:34
Other Links: branch diff | manifest | tags
Context
2012-12-19
22:20
objfw-config: Never output more than one line. check-in: 20d39260d9 user: js tags: 0.7
2012-12-11
12:14
OFTCPSocket: Fix a bug in -[accept]. check-in: 37e165aaf6 user: js tags: 0.7
2012-12-06
01:08
runtime.h: Remove functions which are elsewhere. check-in: caea9cb377 user: js tags: 0.7
Changes

Modified src/OFTCPSocket.m from [c453a27f56] to [a2d531d058].

623
624
625
626
627
628
629
630
631
632

633
634
635
636

637
638
639

640
641
642
643
644
645
646
647
648
649
650
623
624
625
626
627
628
629



630




631

632

633

634
635

636
637
638
639
640
641
642







-
-
-
+
-
-
-
-
+
-

-
+
-


-







	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;
}