Comment: | Rename OFAlready{Connected -> Open}Exception |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
29a41e5a787d830a12e1affcf8091c35 |
User & Date: | js on 2022-12-27 13:58:36 |
Other Links: | manifest | tags |
2022-12-29
| ||
14:58 | configure: Improve test for posix_spawn check-in: 50d586e779 user: js tags: trunk | |
2022-12-27
| ||
13:58 | Rename OFAlready{Connected -> Open}Exception check-in: 29a41e5a78 user: js tags: trunk | |
2022-12-26
| ||
01:54 | OFMutableArray: Fix constness check-in: 9fd8b1301a user: js tags: trunk | |
Modified src/OFDDPSocket.h from [0a178ce3d0] to [20c45dc826].
︙ | ︙ | |||
77 78 79 80 81 82 83 | * @param port The port to bind to. 0 means to pick one and return it via the * returned socket address. * @param protocolType The DDP protocol type to use. Must not be 0. If you want * to use DDP directly and not a protocol built on top of * it, use 11 for compatibility with Open Transport. * @return The address on which this socket can be reached * @throw OFBindDDPSockeFailedException Binding failed | | | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | * @param port The port to bind to. 0 means to pick one and return it via the * returned socket address. * @param protocolType The DDP protocol type to use. Must not be 0. If you want * to use DDP directly and not a protocol built on top of * it, use 11 for compatibility with Open Transport. * @return The address on which this socket can be reached * @throw OFBindDDPSockeFailedException Binding failed * @throw OFAlreadyOpenException The socket is already bound */ - (OFSocketAddress)bindToNetwork: (uint16_t)network node: (uint8_t)node port: (uint8_t)port protocolType: (uint8_t)protocolType; @end |
︙ | ︙ |
Modified src/OFDDPSocket.m from [d532fdd70f] to [d769c899b6].
︙ | ︙ | |||
21 22 23 24 25 26 27 | # include <fcntl.h> #endif #import "OFDDPSocket.h" #import "OFSocket.h" #import "OFSocket+Private.h" | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # include <fcntl.h> #endif #import "OFDDPSocket.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFAlreadyOpenException.h" #import "OFBindDDPSocketFailedException.h" #import "OFInvalidArgumentException.h" #import "OFNotOpenException.h" #import "OFReadFailedException.h" #import "OFWriteFailedException.h" #ifdef OF_HAVE_NETAT_APPLETALK_H |
︙ | ︙ | |||
63 64 65 66 67 68 69 | int flags; #endif if (protocolType == 0) @throw [OFInvalidArgumentException exception]; if (_socket != OFInvalidSocketHandle) | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | int flags; #endif if (protocolType == 0) @throw [OFInvalidArgumentException exception]; if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; address = OFSocketAddressMakeAppleTalk(network, node, port); #if defined(OF_MACOS) if ((_socket = socket(address.sockaddr.at.sat_family, SOCK_RAW | SOCK_CLOEXEC, protocolType)) == OFInvalidSocketHandle) #elif defined(OF_WINDOWS) |
︙ | ︙ |
Modified src/OFHTTPClient.h from [03e878758b] to [3625e60bd3].
︙ | ︙ | |||
182 183 184 185 186 187 188 | * * @param request The request to perform * @return The OFHTTPResponse for the request * @throw OFHTTPRequestFailedException The HTTP request failed * @throw OFInvalidServerResponseException The server sent an invalid response * @throw OFUnsupportedVersionException The server responded in an unsupported * version | | | | | | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | * * @param request The request to perform * @return The OFHTTPResponse for the request * @throw OFHTTPRequestFailedException The HTTP request failed * @throw OFInvalidServerResponseException The server sent an invalid response * @throw OFUnsupportedVersionException The server responded in an unsupported * version * @throw OFAlreadyOpenException The client is already performing a request */ - (OFHTTPResponse *)performRequest: (OFHTTPRequest *)request; /** * @brief Synchronously performs the specified HTTP request. * * @note You must not change the delegate while a synchronous request is * running! If you want to change the delegate during the request, * perform an asynchronous request instead! * * @param request The request to perform * @param redirects The maximum number of redirects after which no further * attempt is done to follow the redirect, but instead the * redirect is treated as an OFHTTPResponse * @return The OFHTTPResponse for the request * @throw OFHTTPRequestFailedException The HTTP request failed * @throw OFInvalidServerResponseException The server sent an invalid response * @throw OFUnsupportedVersionException The server responded in an unsupported * version * @throw OFAlreadyOpenException The client is already performing a request */ - (OFHTTPResponse *)performRequest: (OFHTTPRequest *)request redirects: (unsigned int)redirects; /** * @brief Asynchronously performs the specified HTTP request. * * @param request The request to perform * @throw OFAlreadyOpenException The client is already performing a request */ - (void)asyncPerformRequest: (OFHTTPRequest *)request; /** * @brief Asynchronously performs the specified HTTP request. * * @param request The request to perform * @param redirects The maximum number of redirects after which no further * attempt is done to follow the redirect, but instead the * redirect is treated as an OFHTTPResponse * @throw OFAlreadyOpenException The client is already performing a request */ - (void)asyncPerformRequest: (OFHTTPRequest *)request redirects: (unsigned int)redirects; /** * @brief Closes connections that are still open due to keep-alive. */ - (void)close; @end OF_ASSUME_NONNULL_END |
Modified src/OFHTTPClient.m from [a528d4ec58] to [664acac6f7].
︙ | ︙ | |||
29 30 31 32 33 34 35 | #import "OFKernelEventObserver.h" #import "OFNumber.h" #import "OFRunLoop.h" #import "OFString.h" #import "OFTCPSocket.h" #import "OFTLSStream.h" | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #import "OFKernelEventObserver.h" #import "OFNumber.h" #import "OFRunLoop.h" #import "OFString.h" #import "OFTCPSocket.h" #import "OFTLSStream.h" #import "OFAlreadyOpenException.h" #import "OFHTTPRequestFailedException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidEncodingException.h" #import "OFInvalidFormatException.h" #import "OFInvalidServerResponseException.h" #import "OFNotImplementedException.h" #import "OFNotOpenException.h" |
︙ | ︙ | |||
1273 1274 1275 1276 1277 1278 1279 | OFString *scheme = IRI.scheme; if ([scheme caseInsensitiveCompare: @"http"] != OFOrderedSame && [scheme caseInsensitiveCompare: @"https"] != OFOrderedSame) @throw [OFUnsupportedProtocolException exceptionWithIRI: IRI]; if (_inProgress) | | | 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 | OFString *scheme = IRI.scheme; if ([scheme caseInsensitiveCompare: @"http"] != OFOrderedSame && [scheme caseInsensitiveCompare: @"https"] != OFOrderedSame) @throw [OFUnsupportedProtocolException exceptionWithIRI: IRI]; if (_inProgress) @throw [OFAlreadyOpenException exceptionWithObject: self]; _inProgress = true; [[[[OFHTTPClientRequestHandler alloc] initWithClient: self request: request redirects: redirects] autorelease] start]; |
︙ | ︙ |
Modified src/OFHTTPServer.h from [ba5fc5aae1] to [afb1c28d66].
︙ | ︙ | |||
102 103 104 105 106 107 108 | OFArray *_threadPool; #endif } /** * @brief The host on which the HTTP server will listen. * | | | | | | | | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | OFArray *_threadPool; #endif } /** * @brief The host on which the HTTP server will listen. * * @throw OFAlreadyOpenException The host could not be set because @ref start * had already been called */ @property OF_NULLABLE_PROPERTY (copy, nonatomic) OFString *host; /** * @brief The port on which the HTTP server will listen. * * @throw OFAlreadyOpenException The port could not be set because @ref start * had already been called */ @property (nonatomic) uint16_t port; /** * @brief The delegate for the HTTP server. */ @property OF_NULLABLE_PROPERTY (assign, nonatomic) id <OFHTTPServerDelegate> delegate; #ifdef OF_HAVE_THREADS /** * @brief The number of threads the OFHTTPServer should use. * * If this is larger than 1 (the default), one thread will be used to accept * incoming connections and all others will be used to handle connections. * * For maximum CPU utilization, set this to `[OFSystemInfo numberOfCPUs] + 1`. * * @throw OFAlreadyOpenException The number of threads could not be set because * @ref start had already been called */ @property (nonatomic) size_t numberOfThreads; #endif /** * @brief The server name the server presents to clients. * |
︙ | ︙ | |||
154 155 156 157 158 159 160 | * @return A new HTTP server */ + (instancetype)server; /** * @brief Starts the HTTP server in the current thread's run loop. * | | | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | * @return A new HTTP server */ + (instancetype)server; /** * @brief Starts the HTTP server in the current thread's run loop. * * @throw OFAlreadyOpenException The server had already been started */ - (void)start; /** * @brief Stops the HTTP server, meaning it will not accept any new incoming * connections, but still handle existing connections until they are * finished or timed out. */ - (void)stop; @end OF_ASSUME_NONNULL_END |
Modified src/OFHTTPServer.m from [cee3752fc6] to [ef058caeb6].
︙ | ︙ | |||
31 32 33 34 35 36 37 | #import "OFIRI.h" #import "OFNumber.h" #import "OFSocket+Private.h" #import "OFTCPSocket.h" #import "OFThread.h" #import "OFTimer.h" | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #import "OFIRI.h" #import "OFNumber.h" #import "OFSocket+Private.h" #import "OFTCPSocket.h" #import "OFThread.h" #import "OFTimer.h" #import "OFAlreadyOpenException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidEncodingException.h" #import "OFInvalidFormatException.h" #import "OFNotOpenException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "OFTruncatedDataException.h" |
︙ | ︙ | |||
800 801 802 803 804 805 806 | } - (void)setHost: (OFString *)host { OFString *old; if (_listeningSocket != nil) | | | | | | 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 | } - (void)setHost: (OFString *)host { OFString *old; if (_listeningSocket != nil) @throw [OFAlreadyOpenException exceptionWithObject: self]; old = _host; _host = [host copy]; [old release]; } - (OFString *)host { return _host; } - (void)setPort: (uint16_t)port { if (_listeningSocket != nil) @throw [OFAlreadyOpenException exceptionWithObject: self]; _port = port; } - (uint16_t)port { return _port; } #ifdef OF_HAVE_THREADS - (void)setNumberOfThreads: (size_t)numberOfThreads { if (numberOfThreads == 0) @throw [OFInvalidArgumentException exception]; if (_listeningSocket != nil) @throw [OFAlreadyOpenException exceptionWithObject: self]; _numberOfThreads = numberOfThreads; } - (size_t)numberOfThreads { return _numberOfThreads; } #endif - (void)start { void *pool = objc_autoreleasePoolPush(); if (_host == nil) @throw [OFInvalidArgumentException exception]; if (_listeningSocket != nil) @throw [OFAlreadyOpenException exceptionWithObject: self]; _listeningSocket = [[OFTCPSocket alloc] init]; _port = [_listeningSocket bindToHost: _host port: _port]; [_listeningSocket listen]; #ifdef OF_HAVE_THREADS if (_numberOfThreads > 1) { |
︙ | ︙ |
Modified src/OFIPXSocket.h from [9b20f2a38c] to [a7157643c9].
︙ | ︙ | |||
71 72 73 74 75 76 77 | * @param node The IPX network to bind to. An all zero node means the * computer's node. * @param port The port (sometimes called socket number) to bind to. 0 means to * pick one and return via the returned socket address. * @param packetType The packet type to use on the socket * @return The address on which this socket can be reached * @throw OFBindIPXSocketFailedException Binding failed | | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | * @param node The IPX network to bind to. An all zero node means the * computer's node. * @param port The port (sometimes called socket number) to bind to. 0 means to * pick one and return via the returned socket address. * @param packetType The packet type to use on the socket * @return The address on which this socket can be reached * @throw OFBindIPXSocketFailedException Binding failed * @throw OFAlreadyOpenException The socket is already bound */ - (OFSocketAddress) bindToNetwork: (uint32_t)network node: (const unsigned char [_Nonnull IPX_NODE_LEN])node port: (uint16_t)port packetType: (uint8_t)packetType; @end |
︙ | ︙ |
Modified src/OFIPXSocket.m from [1dc137a6b3] to [39b3f18073].
︙ | ︙ | |||
21 22 23 24 25 26 27 | # include <fcntl.h> #endif #import "OFIPXSocket.h" #import "OFSocket.h" #import "OFSocket+Private.h" | | | | 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 | # include <fcntl.h> #endif #import "OFIPXSocket.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFAlreadyOpenException.h" #import "OFBindIPXSocketFailedException.h" @implementation OFIPXSocket @dynamic delegate; - (OFSocketAddress)bindToNetwork: (uint32_t)network node: (const unsigned char [IPX_NODE_LEN])node port: (uint16_t)port packetType: (uint8_t)packetType { OFSocketAddress address; int protocol = 0; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) int flags; #endif if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; address = OFSocketAddressMakeIPX(network, node, port); #ifdef OF_WINDOWS protocol = NSPROTO_IPX + packetType; #else _packetType = address.sockaddr.ipx.sipx_type = packetType; |
︙ | ︙ |
Modified src/OFSPXSocket.h from [62171025db] to [57c563183a].
︙ | ︙ | |||
86 87 88 89 90 91 92 | * @brief Connect the OFSPXSocket to the specified destination. * * @param network The network on which the node to connect to is * @param node The node to connect to * @param port The port (sometimes also called socket number) on the node to * connect to * @throw OFConnectSPXSocketFailedException Connecting failed | | | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | * @brief Connect the OFSPXSocket to the specified destination. * * @param network The network on which the node to connect to is * @param node The node to connect to * @param port The port (sometimes also called socket number) on the node to * connect to * @throw OFConnectSPXSocketFailedException Connecting failed * @throw OFAlreadyOpenException The socket is already connected or bound */ - (void)connectToNetwork: (uint32_t)network node: (const unsigned char [_Nonnull IPX_NODE_LEN])node port: (uint16_t)port; /** * @brief Asynchronously connect the OFSPXSocket to the specified destination. |
︙ | ︙ | |||
160 161 162 163 164 165 166 | * @param network The IPX network to bind to. 0 means the current network. * @param node The IPX network to bind to. An all zero node means the * computer's node. * @param port The port (sometimes called socket number) to bind to. 0 means to * pick one and return via the returned socket address. * @return The address on which this socket can be reached * @throw OFBindIPXSocketFailedException Binding failed | | | 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | * @param network The IPX network to bind to. 0 means the current network. * @param node The IPX network to bind to. An all zero node means the * computer's node. * @param port The port (sometimes called socket number) to bind to. 0 means to * pick one and return via the returned socket address. * @return The address on which this socket can be reached * @throw OFBindIPXSocketFailedException Binding failed * @throw OFAlreadyOpenException The socket is already connected or bound */ - (OFSocketAddress) bindToNetwork: (uint32_t)network node: (const unsigned char [_Nonnull IPX_NODE_LEN])node port: (uint16_t)port; @end OF_ASSUME_NONNULL_END |
Modified src/OFSPXSocket.m from [4bb1b2f501] to [4f23dae8ee].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #import "OFSPXSocket.h" #import "OFRunLoop.h" #import "OFRunLoop+Private.h" #import "OFSocket.h" #import "OFSocket+Private.h" | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #import "OFSPXSocket.h" #import "OFRunLoop.h" #import "OFRunLoop+Private.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFAlreadyOpenException.h" #import "OFBindIPXSocketFailedException.h" #import "OFConnectSPXSocketFailedException.h" #import "OFNotOpenException.h" #ifndef NSPROTO_SPX # define NSPROTO_SPX 0 #endif |
︙ | ︙ | |||
181 182 183 184 185 186 187 | errNo: (int *)errNo { #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) int flags; #endif if (_socket != OFInvalidSocketHandle) | | | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | errNo: (int *)errNo { #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) int flags; #endif if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; if ((_socket = socket(address->sockaddr.ipx.sipx_family, SOCK_SEQPACKET | SOCK_CLOEXEC, NSPROTO_SPX)) == OFInvalidSocketHandle) { *errNo = OFSocketErrNo(); return false; } |
︙ | ︙ | |||
319 320 321 322 323 324 325 | { OFSocketAddress address; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) int flags; #endif if (_socket != OFInvalidSocketHandle) | | | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | { OFSocketAddress address; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) int flags; #endif if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; address = OFSocketAddressMakeIPX(network, node, port); if ((_socket = socket(address.sockaddr.ipx.sipx_family, SOCK_SEQPACKET | SOCK_CLOEXEC, NSPROTO_SPX)) == OFInvalidSocketHandle) @throw [OFBindIPXSocketFailedException |
︙ | ︙ |
Modified src/OFSPXStreamSocket.h from [454aa9fc7f] to [65e393be71].
︙ | ︙ | |||
87 88 89 90 91 92 93 | * @brief Connect the OFSPXStreamSocket to the specified destination. * * @param network The network on which the node to connect to is * @param node The node to connect to * @param port The port (sometimes also called socket number) on the node to * connect to * @throw OFConnectSPXSocketFailedException Connecting failed | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | * @brief Connect the OFSPXStreamSocket to the specified destination. * * @param network The network on which the node to connect to is * @param node The node to connect to * @param port The port (sometimes also called socket number) on the node to * connect to * @throw OFConnectSPXSocketFailedException Connecting failed * @throw OFAlreadyOpenException The socket is already connected or bound */ - (void)connectToNetwork: (uint32_t)network node: (const unsigned char [_Nonnull IPX_NODE_LEN])node port: (uint16_t)port; /** * @brief Asynchronously connect the OFSPXStreamSocket to the specified |
︙ | ︙ | |||
165 166 167 168 169 170 171 | * @param network The IPX network to bind to. 0 means the current network. * @param node The IPX network to bind to. An all zero node means the * computer's node. * @param port The port (sometimes called socket number) to bind to. 0 means to * pick one and return via the returned socket address. * @return The address on which this socket can be reached * @throw OFBindIPXSocketFailedException Binding failed | | | 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | * @param network The IPX network to bind to. 0 means the current network. * @param node The IPX network to bind to. An all zero node means the * computer's node. * @param port The port (sometimes called socket number) to bind to. 0 means to * pick one and return via the returned socket address. * @return The address on which this socket can be reached * @throw OFBindIPXSocketFailedException Binding failed * @throw OFAlreadyOpenException The socket is already connected or bound */ - (OFSocketAddress) bindToNetwork: (uint32_t)network node: (const unsigned char [_Nonnull IPX_NODE_LEN])node port: (uint16_t)port; @end OF_ASSUME_NONNULL_END |
Modified src/OFSPXStreamSocket.m from [3d76de2dbb] to [e40a25a031].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #import "OFSPXStreamSocket.h" #import "OFRunLoop.h" #import "OFRunLoop+Private.h" #import "OFSocket.h" #import "OFSocket+Private.h" | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #import "OFSPXStreamSocket.h" #import "OFRunLoop.h" #import "OFRunLoop+Private.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFAlreadyOpenException.h" #import "OFBindIPXSocketFailedException.h" #import "OFConnectSPXSocketFailedException.h" #import "OFNotOpenException.h" #ifndef NSPROTO_SPX # define NSPROTO_SPX 0 #endif |
︙ | ︙ | |||
183 184 185 186 187 188 189 | errNo: (int *)errNo { #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) int flags; #endif if (_socket != OFInvalidSocketHandle) | | | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | errNo: (int *)errNo { #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) int flags; #endif if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; if ((_socket = socket(address->sockaddr.ipx.sipx_family, SOCK_STREAM | SOCK_CLOEXEC, NSPROTO_SPX)) == OFInvalidSocketHandle) { *errNo = OFSocketErrNo(); return false; } |
︙ | ︙ | |||
321 322 323 324 325 326 327 | { OFSocketAddress address; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) int flags; #endif if (_socket != OFInvalidSocketHandle) | | | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | { OFSocketAddress address; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) int flags; #endif if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; address = OFSocketAddressMakeIPX(network, node, port); if ((_socket = socket(address.sockaddr.ipx.sipx_family, SOCK_STREAM | SOCK_CLOEXEC, NSPROTO_SPX)) == OFInvalidSocketHandle) @throw [OFBindIPXSocketFailedException exceptionWithNetwork: network |
︙ | ︙ |
Modified src/OFTCPSocket.h from [522e53453c] to [13057c64fa].
︙ | ︙ | |||
153 154 155 156 157 158 159 | /** * @brief Connects the OFTCPSocket to the specified destination. * * @param host The host to connect to * @param port The port on the host to connect to * @throw OFConnectIPSocketFailedException Connecting failed | | | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | /** * @brief Connects the OFTCPSocket to the specified destination. * * @param host The host to connect to * @param port The port on the host to connect to * @throw OFConnectIPSocketFailedException Connecting failed * @throw OFAlreadyOpenException The socket is already connected or bound */ - (void)connectToHost: (OFString *)host port: (uint16_t)port; /** * @brief Asynchronously connects the OFTCPSocket to the specified destination. * * @param host The host to connect to |
︙ | ︙ | |||
211 212 213 214 215 216 217 | * * @param host The host to bind to. Use `@"0.0.0.0"` for IPv4 or `@"::"` for * IPv6 to bind to all. * @param port The port to bind to. If the port is 0, an unused port will be * chosen, which can be obtained using the return value. * @return The port the socket was bound to * @throw OFBindIPSocketFailedException Binding failed | | | 211 212 213 214 215 216 217 218 219 220 221 222 223 | * * @param host The host to bind to. Use `@"0.0.0.0"` for IPv4 or `@"::"` for * IPv6 to bind to all. * @param port The port to bind to. If the port is 0, an unused port will be * chosen, which can be obtained using the return value. * @return The port the socket was bound to * @throw OFBindIPSocketFailedException Binding failed * @throw OFAlreadyOpenException The socket is already connected or bound */ - (uint16_t)bindToHost: (OFString *)host port: (uint16_t)port; @end OF_ASSUME_NONNULL_END |
Modified src/OFTCPSocket.m from [bab73573da] to [028c779a0b].
︙ | ︙ | |||
39 40 41 42 43 44 45 | #import "OFRunLoop+Private.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFString.h" #import "OFTCPSocketSOCKS5Connector.h" #import "OFThread.h" | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #import "OFRunLoop+Private.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFString.h" #import "OFTCPSocketSOCKS5Connector.h" #import "OFThread.h" #import "OFAlreadyOpenException.h" #import "OFBindIPSocketFailedException.h" #import "OFGetOptionFailedException.h" #import "OFNotImplementedException.h" #import "OFNotOpenException.h" #import "OFSetOptionFailedException.h" static const OFRunLoopMode connectRunLoopMode = |
︙ | ︙ | |||
137 138 139 140 141 142 143 | errNo: (int *)errNo { #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) int flags; #endif if (_socket != OFInvalidSocketHandle) | | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | errNo: (int *)errNo { #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) int flags; #endif if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; if ((_socket = socket( ((struct sockaddr *)&address->sockaddr)->sa_family, SOCK_STREAM | SOCK_CLOEXEC, 0)) == OFInvalidSocketHandle) { *errNo = OFSocketErrNo(); return false; } |
︙ | ︙ | |||
296 297 298 299 300 301 302 | OFData *socketAddresses; OFSocketAddress address; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) int flags; #endif if (_socket != OFInvalidSocketHandle) | | | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | OFData *socketAddresses; OFSocketAddress address; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) int flags; #endif if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; if (_SOCKS5Host != nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; socketAddresses = [[OFThread DNSResolver] resolveAddressesForHost: host |
︙ | ︙ |
Modified src/OFTLSStream.h from [8cbbbbbe33] to [e2ca141274].
︙ | ︙ | |||
125 126 127 128 129 130 131 | /** * @brief Asynchronously performs the TLS client handshake for the specified * host and calls the delegate afterwards. * * @param host The host to perform the handshake with * @throw OFTLSHandshakeFailedException The TLS handshake failed | | | | | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | /** * @brief Asynchronously performs the TLS client handshake for the specified * host and calls the delegate afterwards. * * @param host The host to perform the handshake with * @throw OFTLSHandshakeFailedException The TLS handshake failed * @throw OFAlreadyOpenException The handshake was already performed */ - (void)asyncPerformClientHandshakeWithHost: (OFString *)host; /** * @brief Asynchronously performs the TLS client handshake for the specified * host and calls the delegate afterwards. * * @param host The host to perform the handshake with * @param runLoopMode The run loop mode in which to perform the async handshake * @throw OFTLSHandshakeFailedException The TLS handshake failed * @throw OFAlreadyOpenException The handshake was already performed */ - (void)asyncPerformClientHandshakeWithHost: (OFString *)host runLoopMode: (OFRunLoopMode)runLoopMode; /** * @brief Performs the TLS client handshake for the specified host. * * @param host The host to perform the handshake with * @throw OFTLSHandshakeFailedException The TLS handshake failed * @throw OFAlreadyOpenException The handshake was already performed */ - (void)performClientHandshakeWithHost: (OFString *)host; @end #ifdef __cplusplus extern "C" { #endif |
︙ | ︙ |
Modified src/OFUDPSocket.h from [9190ffdfc0] to [c24a066509].
︙ | ︙ | |||
69 70 71 72 73 74 75 | * * @param host The host to bind to. Use `@"0.0.0.0"` for IPv4 or `@"::"` for * IPv6 to bind to all. * @param port The port to bind to. If the port is 0, an unused port will be * chosen, which can be obtained using the return value. * @return The port the socket was bound to * @throw OFBindIPSocketFailedException Binding failed | | | 69 70 71 72 73 74 75 76 77 78 79 80 81 | * * @param host The host to bind to. Use `@"0.0.0.0"` for IPv4 or `@"::"` for * IPv6 to bind to all. * @param port The port to bind to. If the port is 0, an unused port will be * chosen, which can be obtained using the return value. * @return The port the socket was bound to * @throw OFBindIPSocketFailedException Binding failed * @throw OFAlreadyOpenException The socket is already bound */ - (uint16_t)bindToHost: (OFString *)host port: (uint16_t)port; @end OF_ASSUME_NONNULL_END |
Modified src/OFUDPSocket.m from [67c55bc52f] to [2ed8120a61].
︙ | ︙ | |||
30 31 32 33 34 35 36 | #import "OFUDPSocket+Private.h" #import "OFDNSResolver.h" #import "OFData.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFThread.h" | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #import "OFUDPSocket+Private.h" #import "OFDNSResolver.h" #import "OFData.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFThread.h" #import "OFAlreadyOpenException.h" #import "OFBindIPSocketFailedException.h" @implementation OFUDPSocket @dynamic delegate; - (uint16_t)of_bindToAddress: (OFSocketAddress *)address extraType: (int)extraType OF_DIRECT |
︙ | ︙ | |||
172 173 174 175 176 177 178 | - (uint16_t)bindToHost: (OFString *)host port: (uint16_t)port { void *pool = objc_autoreleasePoolPush(); OFData *socketAddresses; OFSocketAddress address; if (_socket != OFInvalidSocketHandle) | | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | - (uint16_t)bindToHost: (OFString *)host port: (uint16_t)port { void *pool = objc_autoreleasePoolPush(); OFData *socketAddresses; OFSocketAddress address; if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; socketAddresses = [[OFThread DNSResolver] resolveAddressesForHost: host addressFamily: OFSocketAddressFamilyAny]; address = *(OFSocketAddress *)[socketAddresses itemAtIndex: 0]; OFSocketAddressSetIPPort(&address, port); |
︙ | ︙ |
Modified src/OFUNIXDatagramSocket.h from [0a3ec7f2ad] to [6213b54745].
︙ | ︙ | |||
62 63 64 65 66 67 68 | /** * @brief Bind the socket to the specified path. * * @param path The path to bind to * @return The address on which this socket can be reached * @throw OFBindUNIXSocketFailedException Binding failed | | | 62 63 64 65 66 67 68 69 70 71 72 73 74 | /** * @brief Bind the socket to the specified path. * * @param path The path to bind to * @return The address on which this socket can be reached * @throw OFBindUNIXSocketFailedException Binding failed * @throw OFAlreadyOpenException The socket is already bound */ - (OFSocketAddress)bindToPath: (OFString *)path; @end OF_ASSUME_NONNULL_END |
Modified src/OFUNIXDatagramSocket.m from [7203060d9a] to [3db54c33e3].
︙ | ︙ | |||
20 21 22 23 24 25 26 | #endif #import "OFUNIXDatagramSocket.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFString.h" | | | | 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 | #endif #import "OFUNIXDatagramSocket.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFString.h" #import "OFAlreadyOpenException.h" #import "OFBindUNIXSocketFailedException.h" @implementation OFUNIXDatagramSocket @dynamic delegate; - (OFSocketAddress)bindToPath: (OFString *)path { OFSocketAddress address; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) int flags; #endif if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; address = OFSocketAddressMakeUNIX(path); if ((_socket = socket(address.sockaddr.un.sun_family, SOCK_DGRAM | SOCK_CLOEXEC, 0)) == OFInvalidSocketHandle) @throw [OFBindUNIXSocketFailedException exceptionWithPath: path |
︙ | ︙ |
Modified src/OFUNIXStreamSocket.h from [3d105f3c9b] to [d2b820f8fa].
︙ | ︙ | |||
51 52 53 54 55 56 57 | id <OFUNIXStreamSocketDelegate> delegate; /** * @brief Connects the OFUNIXStreamSocket to the specified destination. * * @param path The path to connect to * @throw OFConnectUNIXSocketFailedException Connecting failed | | | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | id <OFUNIXStreamSocketDelegate> delegate; /** * @brief Connects the OFUNIXStreamSocket to the specified destination. * * @param path The path to connect to * @throw OFConnectUNIXSocketFailedException Connecting failed * @throw OFAlreadyOpenException The socket is already connected or bound */ - (void)connectToPath: (OFString *)path; /** * @brief Binds the socket to the specified host and port. * * @param path The path to bind to * @throw OFBindUNIXSocketFailedException Binding failed * @throw OFAlreadyOpenException The socket is already connected or bound */ - (void)bindToPath: (OFString *)path; @end OF_ASSUME_NONNULL_END |
Modified src/OFUNIXStreamSocket.m from [ff26304fa1] to [352473aa39].
︙ | ︙ | |||
20 21 22 23 24 25 26 | #endif #import "OFUNIXStreamSocket.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFString.h" | | | | 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 | #endif #import "OFUNIXStreamSocket.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFString.h" #import "OFAlreadyOpenException.h" #import "OFBindUNIXSocketFailedException.h" #import "OFConnectUNIXSocketFailedException.h" @implementation OFUNIXStreamSocket @dynamic delegate; - (void)connectToPath: (OFString *)path { OFSocketAddress address; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) int flags; #endif if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; address = OFSocketAddressMakeUNIX(path); if ((_socket = socket(address.sockaddr.un.sun_family, SOCK_STREAM | SOCK_CLOEXEC, 0)) == OFInvalidSocketHandle) @throw [OFConnectUNIXSocketFailedException exceptionWithPath: path |
︙ | ︙ | |||
75 76 77 78 79 80 81 | { OFSocketAddress address; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) int flags; #endif if (_socket != OFInvalidSocketHandle) | | | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | { OFSocketAddress address; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) int flags; #endif if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyOpenException exceptionWithObject: self]; address = OFSocketAddressMakeUNIX(path); if ((_socket = socket(address.sockaddr.un.sun_family, SOCK_STREAM | SOCK_CLOEXEC, 0)) == OFInvalidSocketHandle) @throw [OFBindUNIXSocketFailedException exceptionWithPath: path |
︙ | ︙ |
Modified src/ObjFW.h from [a1674a4bb5] to [32b85b610c].
︙ | ︙ | |||
139 140 141 142 143 144 145 146 147 148 149 150 151 152 | #import "OFRunLoop.h" #ifdef OF_WINDOWS # import "OFWindowsRegistryKey.h" #endif #import "OFAllocFailedException.h" #import "OFException.h" #import "OFChangeCurrentDirectoryFailedException.h" #import "OFChecksumMismatchException.h" #import "OFCopyItemFailedException.h" #import "OFCreateDirectoryFailedException.h" #import "OFCreateSymbolicLinkFailedException.h" #import "OFEnumerationMutationException.h" | > | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | #import "OFRunLoop.h" #ifdef OF_WINDOWS # import "OFWindowsRegistryKey.h" #endif #import "OFAllocFailedException.h" #import "OFAlreadyOpenException.h" #import "OFException.h" #import "OFChangeCurrentDirectoryFailedException.h" #import "OFChecksumMismatchException.h" #import "OFCopyItemFailedException.h" #import "OFCreateDirectoryFailedException.h" #import "OFCreateSymbolicLinkFailedException.h" #import "OFEnumerationMutationException.h" |
︙ | ︙ | |||
189 190 191 192 193 194 195 | #import "OFUnknownXMLEntityException.h" #import "OFUnlockFailedException.h" #import "OFUnsupportedProtocolException.h" #import "OFUnsupportedVersionException.h" #import "OFWriteFailedException.h" #ifdef OF_HAVE_SOCKETS # import "OFAcceptSocketFailedException.h" | < | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | #import "OFUnknownXMLEntityException.h" #import "OFUnlockFailedException.h" #import "OFUnsupportedProtocolException.h" #import "OFUnsupportedVersionException.h" #import "OFWriteFailedException.h" #ifdef OF_HAVE_SOCKETS # import "OFAcceptSocketFailedException.h" # import "OFBindIPSocketFailedException.h" # import "OFBindSocketFailedException.h" # import "OFConnectIPSocketFailedException.h" # import "OFConnectSocketFailedException.h" # import "OFDNSQueryFailedException.h" # import "OFHTTPRequestFailedException.h" # import "OFListenOnSocketFailedException.h" |
︙ | ︙ |
Modified src/exceptions/Makefile from [0588e3b54e] to [c441977bfd].
1 2 3 4 5 6 7 8 9 10 11 12 13 | include ../../extra.mk STATIC_PIC_LIB_NOINST = ${EXCEPTIONS_LIB_A} STATIC_LIB_NOINST = ${EXCEPTIONS_A} SRCS = OFAllocFailedException.m \ OFChecksumMismatchException.m \ OFCopyItemFailedException.m \ OFCreateDirectoryFailedException.m \ OFCreateSymbolicLinkFailedException.m \ OFEnumerationMutationException.m \ OFException.m \ OFGetItemAttributesFailedException.m \ | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | include ../../extra.mk STATIC_PIC_LIB_NOINST = ${EXCEPTIONS_LIB_A} STATIC_LIB_NOINST = ${EXCEPTIONS_A} SRCS = OFAllocFailedException.m \ OFAlreadyOpenException.m \ OFChecksumMismatchException.m \ OFCopyItemFailedException.m \ OFCreateDirectoryFailedException.m \ OFCreateSymbolicLinkFailedException.m \ OFEnumerationMutationException.m \ OFException.m \ OFGetItemAttributesFailedException.m \ |
︙ | ︙ | |||
50 51 52 53 54 55 56 | ${USE_SRCS_SOCKETS} \ ${USE_SRCS_THREADS} \ ${USE_SRCS_WINDOWS} SRCS_FILES = OFChangeCurrentDirectoryFailedException.m \ OFGetCurrentDirectoryFailedException.m SRCS_PLUGINS = OFLoadPluginFailedException.m SRCS_SOCKETS = OFAcceptSocketFailedException.m \ | < | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | ${USE_SRCS_SOCKETS} \ ${USE_SRCS_THREADS} \ ${USE_SRCS_WINDOWS} SRCS_FILES = OFChangeCurrentDirectoryFailedException.m \ OFGetCurrentDirectoryFailedException.m SRCS_PLUGINS = OFLoadPluginFailedException.m SRCS_SOCKETS = OFAcceptSocketFailedException.m \ OFBindIPSocketFailedException.m \ OFBindSocketFailedException.m \ OFConnectIPSocketFailedException.m \ OFConnectSocketFailedException.m \ OFDNSQueryFailedException.m \ OFHTTPRequestFailedException.m \ OFListenOnSocketFailedException.m \ |
︙ | ︙ |
Renamed and modified src/exceptions/OFAlreadyConnectedException.h [ac208c2ef2] to src/exceptions/OFAlreadyOpenException.h [f7277d1a0d].
︙ | ︙ | |||
11 12 13 14 15 16 17 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" | < < < < | | | | | | | > > > > > < < < < < | | | | > > | | | > > | | 11 12 13 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 50 51 52 53 54 55 56 57 58 59 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" OF_ASSUME_NONNULL_BEGIN /** * @class OFAlreadyOpenException \ * OFAlreadyOpenException.h ObjFW/OFAlreadyOpenException.h * * @brief An exception indicating that an object is already open and thus * cannot be opened again. */ @interface OFAlreadyOpenException: OFException { id _object; OF_RESERVE_IVARS(OFAlreadyOpenException, 4) } /** * @brief The object which is already open. */ @property (readonly, nonatomic) id object; /** * @brief Creates a new, autoreleased already open exception. * * @param object The object which is already open * @return A new, autoreleased already open exception */ + (instancetype)exceptionWithObject: (id)object; + (instancetype)exception OF_UNAVAILABLE; /** * @brief Initializes an already allocated already open exception. * * @param object The object which is already open * @return An initialized already open exception */ - (instancetype)initWithObject: (id)object OF_DESIGNATED_INITIALIZER; - (instancetype)init OF_UNAVAILABLE; @end OF_ASSUME_NONNULL_END |
Renamed and modified src/exceptions/OFAlreadyConnectedException.m [9abd285501] to src/exceptions/OFAlreadyOpenException.m [c81458b855].
︙ | ︙ | |||
11 12 13 14 15 16 17 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" | | | | | | | | | | > > > > > | < | | | | < < | 11 12 13 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 50 51 52 53 54 55 56 57 58 59 60 61 62 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFAlreadyOpenException.h" #import "OFString.h" @implementation OFAlreadyOpenException @synthesize object = _object; + (instancetype)exceptionWithObject: (id)object { return [[[self alloc] initWithObject: object] autorelease]; } + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } - (instancetype)initWithObject: (id)object { self = [super init]; _object = [object retain]; return self; } - (instancetype)init { OF_INVALID_INIT_METHOD } - (void)dealloc { [_object release]; [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"An object of type %@ is already open and thus cannot be opened " @"again!", [_object class]]; } @end |
Modified src/tls/OFGnuTLSTLSStream.m from [fad8797bf6] to [603af24307].
︙ | ︙ | |||
16 17 18 19 20 21 22 | #include "config.h" #include <errno.h> #import "OFGnuTLSTLSStream.h" #import "OFData.h" | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #include "config.h" #include <errno.h> #import "OFGnuTLSTLSStream.h" #import "OFData.h" #import "OFAlreadyOpenException.h" #import "OFInitializationFailedException.h" #import "OFNotOpenException.h" #import "OFReadFailedException.h" #import "OFTLSHandshakeFailedException.h" #import "OFWriteFailedException.h" int _ObjFWTLS_reference; |
︙ | ︙ | |||
198 199 200 201 202 203 204 | { static const OFTLSStreamErrorCode initFailedErrorCode = OFTLSStreamErrorCodeInitializationFailed; id exception = nil; int status; if (_initialized) | | | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | { static const OFTLSStreamErrorCode initFailedErrorCode = OFTLSStreamErrorCodeInitializationFailed; id exception = nil; int status; if (_initialized) @throw [OFAlreadyOpenException exceptionWithObject: self]; if (gnutls_init(&_session, GNUTLS_CLIENT | GNUTLS_NONBLOCK | GNUTLS_SAFE_PADDING_CHECK) != GNUTLS_E_SUCCESS) @throw [OFTLSHandshakeFailedException exceptionWithStream: self host: host errorCode: initFailedErrorCode]; |
︙ | ︙ |
Modified src/tls/OFOpenSSLTLSStream.m from [faf6205c5a] to [0e05259ba1].
︙ | ︙ | |||
16 17 18 19 20 21 22 | #include "config.h" #include <errno.h> #import "OFOpenSSLTLSStream.h" #import "OFData.h" | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #include "config.h" #include <errno.h> #import "OFOpenSSLTLSStream.h" #import "OFData.h" #import "OFAlreadyOpenException.h" #import "OFInitializationFailedException.h" #import "OFNotOpenException.h" #import "OFReadFailedException.h" #import "OFTLSHandshakeFailedException.h" #import "OFWriteFailedException.h" #define bufferSize OFOpenSSLTLSStreamBufferSize |
︙ | ︙ | |||
203 204 205 206 207 208 209 | { static const OFTLSStreamErrorCode initFailedErrorCode = OFTLSStreamErrorCodeInitializationFailed; id exception = nil; int status; if (_SSL != NULL) | | | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | { static const OFTLSStreamErrorCode initFailedErrorCode = OFTLSStreamErrorCodeInitializationFailed; id exception = nil; int status; if (_SSL != NULL) @throw [OFAlreadyOpenException exceptionWithObject: self]; if ((_readBIO = BIO_new(BIO_s_mem())) == NULL) @throw [OFTLSHandshakeFailedException exceptionWithStream: self host: host errorCode: initFailedErrorCode]; |
︙ | ︙ |
Modified src/tls/OFSecureTransportTLSStream.m from [d93ffbbd51] to [7f23554cd3].
︙ | ︙ | |||
15 16 17 18 19 20 21 | #include "config.h" #include <errno.h> #import "OFSecureTransportTLSStream.h" | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include "config.h" #include <errno.h> #import "OFSecureTransportTLSStream.h" #import "OFAlreadyOpenException.h" #import "OFNotOpenException.h" #import "OFReadFailedException.h" #import "OFTLSHandshakeFailedException.h" #import "OFWriteFailedException.h" int _ObjFWTLS_reference; |
︙ | ︙ | |||
184 185 186 187 188 189 190 | { static const OFTLSStreamErrorCode initFailedErrorCode = OFTLSStreamErrorCodeInitializationFailed; id exception = nil; OSStatus status; if (_context != NULL) | | | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | { static const OFTLSStreamErrorCode initFailedErrorCode = OFTLSStreamErrorCodeInitializationFailed; id exception = nil; OSStatus status; if (_context != NULL) @throw [OFAlreadyOpenException exceptionWithObject: self]; #ifdef HAVE_SSLCREATECONTEXT if ((_context = SSLCreateContext(kCFAllocatorDefault, kSSLClientSide, kSSLStreamType)) == NULL) #else if (SSLNewContext(false, &_context) != noErr) #endif |
︙ | ︙ |