Commit Graph
159 Commits
Author SHA1 Message Date
Quan Vo 558fdeb7b6 Swift 4 support 2017-08-23 11:36:57 -05:00
Bill Abt 19163ec97e In the connect API, If the socket is in blocking mode it will be changed to non-blocking mode temporarily if a timeout greater than zero (0) is provided. The returned socket will be set back to its original setting (blocking or non-blocking). This obviates the need to set the socket into non-blocking mode in order to utilize the connection timeout. 2017-08-06 10:15:17 -04:00
Bill Abt 40db185c15 Added new parameter to connect API to allow the setting of a timeout value when using non-blocking sockets. 2017-08-05 11:10:14 -04:00
Bill Abt fb557515d1 Fixed problem with interpreting the passed boolean value. Was disabling broadcast instead of enabling it and vice versa due to an error coding the ternary. 2017-08-03 15:48:55 -04:00
Bill Abt 1e825b58fa Added new utility function, udpBroadcast, to allow enablement and disablement of broadcast mode fro UDP sockets. 2017-08-03 11:58:41 -04:00
Bill Abt 632e6cd9ed If the attempt to set the SO_REUSEPORT socket option fails, check errno for ENOPROTOOPT and if set, silently ignore the error. This can happen when using WSL (Windows Subsystem for Linux). 2017-08-01 11:38:17 -04:00
Bill Abt 52ae8858c9 Fixed some minor swiftlint warnings. 2017-06-21 20:20:20 -04:00
Martin Angers a661bc2dad fix formatting 2017-06-21 14:50:38 -04:00
Martin Angers 52a1d88d4e remove need to force-unwrap path 2017-06-21 14:34:47 -04:00
Martin Angers 776c421c06 replace strncpy with UnsafeMutableBufferPointer 2017-06-21 14:33:15 -04:00
Yossi Mesika 74b5335331 Added missing parameter description and build only on linux 2017-06-09 06:55:23 +03:00
Yossi Mesika 1418e63280 Merge remote-tracking branch 'IBM-Swift/master' 2017-05-23 16:27:47 +03:00
Yossi Mesika 659cfee17c Changed indentation from spaces to tabs as used throughout the code 2017-05-23 16:15:59 +03:00
Yossi Mesika 091eb32e02 Updated SSLServiceDelegate with a function and field to support ALPN and HTTP/2 2017-05-22 21:16:39 +03:00
Bill Abt 3c06c5a5bb During a read operation with truncate equal to true, the memcpy statement was incorrect, causing a buffer overflow. This commit corrects that problem. 2017-05-19 09:18:33 -04:00
Quan Vo a8f5d40ef8 Cast mask to Int32 2017-05-12 16:24:29 -05:00
Bouke Haarsma e639a3fd5e Set SO_REUSEPORT for port sharing on OSX 2017-03-30 22:15:07 +02:00
Bill Abt 0986c40a4d Port check range for connect should've been 1-65535 not 1024-65535.. 2017-03-27 12:53:28 -04:00
Bill Abt c9ff50a4fa Validate the port values passed to connect(to:port:) function and ensure they fall within the proper range. 2017-03-27 12:44:34 -04:00
Bill Abt 6033ce5bae Reduce the default SSL read buffer size. 2017-03-24 16:06:51 -04:00
Bill Abt b7e428d75f When the SSLServiceDelegate is set to a non-nil value, increase the read buffer size to accommodate the TLS packet size. 2017-03-24 10:49:51 -04:00
Bouke Haarsma 8fb7478210 Allow port sharing between ipv4 and ipv6 2017-03-24 07:51:42 +01:00
Bill Abt fa1c82d8ae Minor comment fix. 2017-03-23 17:47:25 -04:00
Bill Abt 755d03812e Added two new functions that allow the setting of a read and write timeout respectively. 2017-03-16 11:52:47 -04:00
Shaun Merchant 22e3d4c3b8 Fix memory leak 2017-03-01 10:36:42 +00:00
Sebastian Kreutzberger 49750c644a Fix warnings under Swift 3.1
Swift is now a bit stricter in terms of output of optional strings and
chaining of types which are not 100% the same (like Int32 vs Int).
2017-02-20 16:52:49 +01:00
Bill Abt 7c7ac6a14b Removed print statement from the didset section of readBufferSize. Changed how the flags are reset during a close to fix a problem in the MongoKitten driver. 2017-02-04 21:56:37 -05:00
Bill Abt 0ca58bd33a Minor changes to correct some error messages that were inaccurate due to cut/paste errors. 2017-01-26 19:38:22 -05:00
Bill Abt aa2caea69e Removed check for remoteConnectionClosed. The check is not needed. The socket is still open under these circumstances and normal error handling should suffice. 2017-01-25 22:12:31 -05:00
Bill Abt 6f8e1c5ba0 If we've indicated that the remote side of the connection is closed, prohibit subsequent reads and writes to the socket. 2017-01-25 20:31:45 -05:00
Bill Abt b789a1d5f9 Change send function signature of the SSLServiceDelegate protocol to not specify an explicitly unwrapped UnsafeRawPointer. Not needed. 2017-01-25 20:31:13 -05:00
Bill Abt 7e995b297e Revert "If we've indicated that the remote connection is closed, prohibit subsequent reads and writes to the socket."
This reverts commit 33b7afd41a.
2017-01-25 12:04:54 -05:00
Bill Abt 33b7afd41a If we've indicated that the remote connection is closed, prohibit subsequent reads and writes to the socket. 2017-01-25 11:52:45 -05:00
Bill Abt 511aed8e25 Fix for issue #49. The path to the UNIX socket should not be deleted on close unless it's the socket that created it in the first place, the one that's listening. 2017-01-22 10:51:04 -05:00
Bill Abt 6101df2df7 Merge pull request #48 from djones6/sigpipe
Always set MSG_NOSIGNAL to avoid process exit due to SIGPIPE
2017-01-17 10:18:04 -05:00
David Jones 127da486e9 Convert spaces to tabs to match rest of source 2017-01-17 11:01:41 +00:00
David Jones 20235281c5 Always set SO_NOSIGPIPE on sockets on Mac 2017-01-17 10:53:47 +00:00
Bill Abt 5a7a76d84a When reusing a socket (i.e.: calling conneect(to:port:)), don't call the SSLService deinitialize() delegate function. 2017-01-16 11:40:15 -05:00
David Jones bbb00bdef9 Always set MSG_NOSIGNAL to avoid process exit due to SIGPIPE 2017-01-16 11:58:41 +00:00
Bill Abt 6f2573ec9f Added 3 missing checks for socket validation prior to function access. 2017-01-12 09:48:32 -05:00
Bill Abt b31b8d5f2f Fix for Kitura issue #959: https://github.com/IBM-Swift/Kitura/issues/959. Need to call SSLServiceDelegate method BEFORE closing the Socket as part of the close() method, not the deinit(). In SSLService, commented out the cleanup of OpenSSL error strings and EVP due to issues discovered in the latest OpenSSL version. 2017-01-10 12:32:11 -05:00
Bill Abt 0d75429b10 Fix for issue #46: socket path corrupt. 2017-01-03 13:20:28 -05:00
Bill Abt a8a99376d3 Minor name changes for conistency. 2016-12-09 15:48:03 -05:00
Bill Abt acf026175b Added comments related to PR42 to additional lines of code where the same thing will occur. 2016-12-09 15:16:19 -05:00
Carl Brown cd92bf21cc Comment only change
This might save people some time.
2016-12-09 13:39:54 -06:00
Bill Abt 55d46ecfa7 Minor improvements to eliminate some forced unwraps of optionals. 2016-12-08 11:36:11 -05:00
Bill Abt 0087fe96c5 Some final UDP cleanup including removal of the truncate parameter from the readDatagram API. Changed the signature of the Signature initializer to include the protocol family, so that you can create both IPv4 and IPv6 signatures. Added additional comments and documentation to the tests. 2016-12-08 10:45:55 -05:00
Frederick Kellison-Linn 9d3e7d4a93 Fix merge conflicts 2016-12-07 17:42:56 -05:00
Bill Abt 528386de13 Fixed function signature for Socket.createAddress. 2016-12-07 17:16:13 -05:00
Bill Abt 6cf4ac1fc2 Cherry-picked some changes from otherwise rejected PR37. Improved some internal documentation. 2016-12-07 17:03:41 -05:00