Differences From Artifact [2de1fb049a]:
- File src/OFTCPSocket.m — part of check-in [f9d12201f8] at 2014-02-18 00:22:43 on branch trunk — Move around a few defines to be more consistent (user: js, size: 11057) [annotate] [blame] [check-ins using]
To Artifact [3b9e3e0a34]:
- File
src/OFTCPSocket.m
— part of check-in
[3fa37632f9]
at
2014-02-21 17:17:04
on branch trunk
— Cast return of sizeof() to socklen_t
It caused a warning about an implicit cast on OS X/PPC64. (user: js, size: 11106) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
381 382 383 384 385 386 387 | if ((_socket = socket(results[0]->family, results[0]->type, results[0]->protocol)) == INVALID_SOCKET) @throw [OFBindFailedException exceptionWithHost: host port: port socket: self]; if (setsockopt(_socket, SOL_SOCKET, SO_REUSEADDR, | | | | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | if ((_socket = socket(results[0]->family, results[0]->type, results[0]->protocol)) == INVALID_SOCKET) @throw [OFBindFailedException exceptionWithHost: host port: port socket: self]; if (setsockopt(_socket, SOL_SOCKET, SO_REUSEADDR, (const char*)&one, (socklen_t)sizeof(one))) @throw [OFSetOptionFailedException exceptionWithStream: self]; if (bind(_socket, results[0]->address, results[0]->addressLength) == -1) { close(_socket); _socket = INVALID_SOCKET; @throw [OFBindFailedException exceptionWithHost: host port: port socket: self]; } } @finally { of_resolver_free(results); } if (port > 0) return port; #ifndef __wii__ addrLen = (socklen_t)sizeof(addr.storage); if (getsockname(_socket, (struct sockaddr*)&addr.storage, &addrLen)) { close(_socket); _socket = INVALID_SOCKET; @throw [OFBindFailedException exceptionWithHost: host port: port socket: self]; } |
︙ | ︙ | |||
448 449 450 451 452 453 454 | - (instancetype)accept { OFTCPSocket *client = [[[[self class] alloc] init] autorelease]; client->_address = [client allocMemoryWithSize: sizeof(struct sockaddr_storage)]; | | | 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | - (instancetype)accept { OFTCPSocket *client = [[[[self class] alloc] init] autorelease]; client->_address = [client allocMemoryWithSize: sizeof(struct sockaddr_storage)]; client->_addressLength = (socklen_t)sizeof(struct sockaddr_storage); if ((client->_socket = accept(_socket, client->_address, &client->_addressLength)) == INVALID_SOCKET) @throw [OFAcceptFailedException exceptionWithSocket: self]; assert(client->_addressLength <= sizeof(struct sockaddr_storage)); |
︙ | ︙ | |||
489 490 491 492 493 494 495 | } #endif - (void)setKeepAlivesEnabled: (bool)enable { int v = enable; | | > | 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | } #endif - (void)setKeepAlivesEnabled: (bool)enable { int v = enable; if (setsockopt(_socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&v, (socklen_t)sizeof(v))) @throw [OFSetOptionFailedException exceptionWithStream: self]; } - (OFString*)remoteAddress { OFString *ret; |
︙ | ︙ |