Overview
Comment: | Generalize forgotten socket related exceptions |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
be1fb59dfa6323cb2885a2f9fed6f83c |
User & Date: | js on 2014-01-27 11:35:27 |
Other Links: | manifest | tags |
Context
2014-01-27
| ||
11:58 | Fix socket.h not being installed check-in: d4c90c0750 user: js tags: trunk | |
11:35 | Generalize forgotten socket related exceptions check-in: be1fb59dfa user: js tags: trunk | |
2014-01-26
| ||
22:38 | Move resolving functionality to resolver.m check-in: 49b1989b63 user: js tags: trunk | |
Changes
Modified src/exceptions/OFAcceptFailedException.h from [5433a5f6c5] to [8f1c5ce95c].
︙ | ︙ | |||
18 19 20 21 22 23 24 | #import "OFException.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif | < < | | | | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | #import "OFException.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif /*! * @brief An exception indicating that accepting a connection failed. */ @interface OFAcceptFailedException: OFException { id _socket; int _errNo; } #ifdef OF_HAVE_PROPERTIES @property (readonly, retain) id socket; @property (readonly) int errNo; #endif /*! * @brief Creates a new, autoreleased accept failed exception. * * @param socket The socket which could not accept a connection * @return A new, autoreleased accept failed exception */ + (instancetype)exceptionWithSocket: (id)socket; /*! * @brief Initializes an already allocated accept failed exception. * * @param socket The socket which could not accept a connection * @return An initialized accept failed exception */ - initWithSocket: (id)socket; /*! * @brief Returns the socket which could not accept a connection. * * @return The socket which could not accept a connection */ - (id)socket; /*! * @brief Returns the errno from when the exception was created. * * @return The errno from when the exception was created */ - (int)errNo; @end |
Modified src/exceptions/OFAcceptFailedException.m from [fed21c88a0] to [36ac9f1562].
︙ | ︙ | |||
14 15 16 17 18 19 20 | * file. */ #include "config.h" #import "OFAcceptFailedException.h" #import "OFString.h" | < | | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | * file. */ #include "config.h" #import "OFAcceptFailedException.h" #import "OFString.h" #import "common.h" #import "macros.h" @implementation OFAcceptFailedException + (instancetype)exceptionWithSocket: (id)socket { return [[[self alloc] initWithSocket: socket] autorelease]; } - init { OF_INVALID_INIT_METHOD } - initWithSocket: (id)socket { self = [super init]; _socket = [socket retain]; _errNo = GET_SOCK_ERRNO; return self; |
︙ | ︙ | |||
54 55 56 57 58 59 60 | - (OFString*)description { return [OFString stringWithFormat: @"Failed to accept connection in socket of class %@! " ERRFMT, [_socket class], ERRPARAM]; } | | | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | - (OFString*)description { return [OFString stringWithFormat: @"Failed to accept connection in socket of class %@! " ERRFMT, [_socket class], ERRPARAM]; } - (id)socket { OF_GETTER(_socket, true) } - (int)errNo { #ifdef _WIN32 return of_wsaerr_to_errno(_errNo); #else return _errNo; #endif } @end |
Modified src/exceptions/OFAlreadyConnectedException.h from [dd3d7a6071] to [d71c747bb3].
︙ | ︙ | |||
16 17 18 19 20 21 22 | #import "OFException.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif | < < | | | | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #import "OFException.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif /*! * @brief An exception indicating an attempt to connect or bind an already * connected or bound socket. */ @interface OFAlreadyConnectedException: OFException { id _socket; } #ifdef OF_HAVE_PROPERTIES @property (readonly, retain) id socket; #endif /*! * @brief Creates a new, autoreleased already connected exception. * * @param socket The socket which is already connected * @return A new, autoreleased already connected exception */ + (instancetype)exceptionWithSocket: (id)socket; /*! * @brief Initializes an already allocated already connected exception. * * @param socket The socket which is already connected * @return An initialized already connected exception */ - initWithSocket: (id)socket; /*! * @brief Returns the socket which is already connected. * * @return The socket which is already connected */ - (id)socket; @end |
Modified src/exceptions/OFAlreadyConnectedException.m from [127aad522e] to [f384be7749].
︙ | ︙ | |||
14 15 16 17 18 19 20 | * file. */ #include "config.h" #import "OFAlreadyConnectedException.h" #import "OFString.h" | < | | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | * file. */ #include "config.h" #import "OFAlreadyConnectedException.h" #import "OFString.h" #import "common.h" @implementation OFAlreadyConnectedException + (instancetype)exceptionWithSocket: (id)socket { return [[[self alloc] initWithSocket: socket] autorelease]; } - initWithSocket: (id)socket { self = [super init]; _socket = [socket retain]; return self; } |
︙ | ︙ | |||
51 52 53 54 55 56 57 | @"The socket of type %@ is already connected or bound and " @"thus can't be connected or bound again!", [_socket class]]; else return @"A connection has already been established!"; } | | | 50 51 52 53 54 55 56 57 58 59 60 61 | @"The socket of type %@ is already connected or bound and " @"thus can't be connected or bound again!", [_socket class]]; else return @"A connection has already been established!"; } - (id)socket { OF_GETTER(_socket, true) } @end |
Modified src/exceptions/OFConnectionFailedException.h from [d46ff45148] to [dfacad7397].
︙ | ︙ | |||
18 19 20 21 22 23 24 | #import "OFException.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif | < < | | | | | | | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | #import "OFException.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif /*! * @brief An exception indicating that a connection could not be established. */ @interface OFConnectionFailedException: OFException { id _socket; OFString *_host; uint16_t _port; int _errNo; } #ifdef OF_HAVE_PROPERTIES @property (readonly, retain) id socket; @property (readonly, copy) OFString *host; @property (readonly) uint16_t port; @property (readonly) int errNo; #endif /*! * @brief Creates a new, autoreleased connection failed exception. * * @param host The host to which the connection failed * @param port The port on the host to which the connection failed * @param socket The socket which could not connect * @return A new, autoreleased connection failed exception */ + (instancetype)exceptionWithHost: (OFString*)host port: (uint16_t)port socket: (id)socket; /*! * @brief Initializes an already allocated connection failed exception. * * @param host The host to which the connection failed * @param port The port on the host to which the connection failed * @param socket The socket which could not connect * @return An initialized connection failed exception */ - initWithHost: (OFString*)host port: (uint16_t)port socket: (id)socket; /*! * @brief Returns the socket which could not connect. * * @return The socket which could not connect */ - (id)socket; /*! * @brief Returns the host to which the connection failed. * * @return The host to which the connection failed */ - (OFString*)host; |
︙ | ︙ |
Modified src/exceptions/OFConnectionFailedException.m from [2e9f453e47] to [9a3aa0b1c9].
︙ | ︙ | |||
14 15 16 17 18 19 20 | * file. */ #include "config.h" #import "OFConnectionFailedException.h" #import "OFString.h" | < | | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | * file. */ #include "config.h" #import "OFConnectionFailedException.h" #import "OFString.h" #import "common.h" #import "macros.h" @implementation OFConnectionFailedException + (instancetype)exceptionWithHost: (OFString*)host port: (uint16_t)port socket: (id)socket { return [[[self alloc] initWithHost: host port: port socket: socket] autorelease]; } - init { OF_INVALID_INIT_METHOD } - initWithHost: (OFString*)host port: (uint16_t)port socket: (id)socket { self = [super init]; @try { _host = [host copy]; _socket = [socket retain]; _port = port; |
︙ | ︙ | |||
79 80 81 82 83 84 85 | } - (uint16_t)port { return _port; } | | | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | } - (uint16_t)port { return _port; } - (id)socket { OF_GETTER(_socket, true) } - (int)errNo { #ifdef _WIN32 return of_wsaerr_to_errno(_errNo); #else return _errNo; #endif } @end |