Overview
Comment: | Fix two more FIXMEs in OFTCPSocket; new exception. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
85f7e202b1297fb11bbcc15f4d8a5231 |
User & Date: | js on 2008-12-11 14:06:41 |
Other Links: | manifest | tags |
Context
2008-12-13
| ||
13:40 | Check for IPv6 support. check-in: c1687f2be3 user: js tags: trunk | |
2008-12-11
| ||
14:06 | Fix two more FIXMEs in OFTCPSocket; new exception. check-in: 85f7e202b1 user: js tags: trunk | |
13:56 | Fix two FIXMEs in OFTCPSocket. check-in: 6d765d0301 user: js tags: trunk | |
Changes
Modified src/OFExceptions.h from [bd5ad34ccf] to [f063fde1b6].
︙ | ︙ | |||
294 295 296 297 298 299 300 301 302 303 304 305 | @end /** * An OFException indicating an attempt to connect or bind an already connected * or bound socket */ @interface OFAlreadyConnectedException: OFException {} /** * \return An error message for the exception as a C string. */ - (char*)cString; @end | > > > > > > > > > > | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | @end /** * An OFException indicating an attempt to connect or bind an already connected * or bound socket */ @interface OFAlreadyConnectedException: OFException {} /** * \return An error message for the exception as a C string. */ - (char*)cString; @end /** * An OFException indicating that the specified port is invalid. */ @interface OFInvalidPortException: OFException /** * \return An error message for the exception as a C string. */ - (char*)cString; @end |
Modified src/OFExceptions.m from [2779dde916] to [c1fe9bf0a6].
︙ | ︙ | |||
318 319 320 321 322 323 324 325 326 327 | { if (string != NULL) return string; asprintf(&string, "The socket of type %s is already connected or bound " "and thus can't be connected or bound again!", [object name]); return string; } @end | > > > > > > > > > > > > > > | 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | { if (string != NULL) return string; asprintf(&string, "The socket of type %s is already connected or bound " "and thus can't be connected or bound again!", [object name]); return string; } @end @implementation OFInvalidPortException - (char*)cString { if (string != NULL) return string; asprintf(&string, "The port specified is not valid for a socket of " "type %s! This usually means you tried to use port 0, which is an " "invalid port.", [object name]); return string; } @end |
Modified src/OFTCPSocket.m from [cbc64c1780] to [275bdc16df].
︙ | ︙ | |||
57 58 59 60 61 62 63 | - connectTo: (const char*)host onPort: (uint16_t)port { struct addrinfo hints, *res, *res0; char portstr[6]; | | | < < | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | - connectTo: (const char*)host onPort: (uint16_t)port { struct addrinfo hints, *res, *res0; char portstr[6]; if (!port) @throw [OFInvalidPortException newWithObject: self]; if (sock >= 0) @throw [OFAlreadyConnectedException newWithObject: self]; memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; |
︙ | ︙ | |||
107 108 109 110 111 112 113 | - bindOn: (const char*)host withPort: (uint16_t)port andFamily: (int)family { struct addrinfo hints, *res; char portstr[6]; | | | < < | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | - bindOn: (const char*)host withPort: (uint16_t)port andFamily: (int)family { struct addrinfo hints, *res; char portstr[6]; if (!port) @throw [OFInvalidPortException newWithObject: self]; if (sock >= 0) @throw [OFAlreadyConnectedException newWithObject: self]; if ((sock = socket(family, SOCK_STREAM, 0)) < 0) { /* FIXME: Throw exception */ return nil; |
︙ | ︙ |