20 Commits
Author SHA1 Message Date
Bill Abt c2cdc36148 Renamed disableSIGPIPE function to ignoreSIGPIPE since that's just a bit more descriptive. Other minor style changes for consistency. 2018-01-19 09:22:22 -05:00
Bill Abt 45da6eb972 Minor style changes. 2018-01-19 09:21:06 -05:00
Jim Dovey 171c7570d7 A few cleanups and one bug fix:
- `fd_set` API is now much nicer and will compile about as close to the C implementation as we can get— especially on release builds, with compiler inlining.
- Socket structure's `readBuffer` now initializes all its bytes to zero, not just the first.
- More idiomatic/concise return expression in `Socket.wait(for:timeout:waitForever:)` (don't build an output array manually, we have `filter(_:)` for that).
- Various non-Linux code to set the `SO_NOSIGPIPE` option has been tucked into a private function now, still containing the compilation conditional. It's a no-op on Linux, and will be inlined by the compiler (since it's private) and the calling code looks much more straightforward.
- BUGFIX: calls to `gai_strerror(_:)` take the result of the `getaddrinfo()` call as a parameter, NOT `errno`.
2018-01-16 12:53:27 -08:00
Bill Abt f9a7368c84 Minor fix in datagram handling when a datagram read is interrupted. 2017-12-14 09:13:11 -05:00
Bill Abt dc44869fc4 Added missing documentation for allowPortReuse on the listen() API. Part of issue #94. 2017-10-26 17:57:38 -04:00
Bill Abt fb0c9c1e87 Introduced OperationInterrupted exception to replace NotAnError that was included in PR #93. This makes things clearer. Also, made the new exception part of Socket to avoid redundant declarations. 2017-10-26 10:03:19 -04:00
Bill Abt abfe351df1 Added missing documentation for new Socket.Address extensions introduced by PR #93. 2017-10-26 10:00:02 -04:00
Bill Abt eaddb730d8 Merge pull request #93 from mcfedr/fix-unsafe-socket
Remove unsafe access to Socket.Address.  Some modifications needed prior to release.
2017-10-26 09:24:27 -04:00
Bill Abt badbf15cb8 Add new parameter for listen() API that allows the caller to decide whether to reuse the listening port or not. Default behavior is to reuse the port. 2017-10-12 10:30:12 -04:00
Fred Cox 2d58a7a264 Remove unsafe access to Socket.Address
asAddr funcs were passing unsafe pointers outside of the callbacks in which try should be used
Using callback to make all the access within these callbacks
Fixes bug where IPv6 address was 'cast' to sockaddr but actually was zero'd beyond the length of sockaddr_in and packets written to the wrong address
2017-10-12 10:51:40 +03:00
Bill Abt 60cf41bcc4 Simplify parameter checking in wait() API. 2017-10-11 09:49:45 -04:00
Bill Abt 5aae4f88a4 Fix logic error in wait() function introduced in previous check-in that allows wait() to be called on UDP socket. 2017-10-09 12:22:44 -04:00
Bill Abt 389bd17eab Allow wait() to be called for UDP sockets that are bound. 2017-10-06 09:46:28 -04:00
Bill Abt 51bde30c86 Update FD_* functions to consistently use Int32 where appropriate. 2017-10-06 09:45:05 -04:00
Bill Abt 1c957b4272 When connecting to a socket, we replace the existing socket with a newly generated one. On macOS, need to set SO_NOSIGPIPE on the new socket. 2017-09-28 09:03:17 -04:00
Bill Abt a985882a9f Posix/BSD/Darwin sockets are not supported by watchOS on native devices. Therefore, removed package/compilation support for that platform. 2017-09-21 10:54:24 -04:00
Bill Abt ddd0be6008 If there's a delegate present, ALWAYS set the needAcceptDelegateCall flag otherwise, the default case won't work. 2017-09-14 12:17:03 -04:00
Bill Abt 5c77668e31 Added new parameter to acceptClientConnection that allows deferral of SSL accept to the application. Added new function, invokeDelegateOnAccept, to invoke the SSL accept. Modification of PR #85. 2017-09-14 11:23:32 -04:00
David Jones 01626cd32f IBM-Swift/Kitura#1143 IBM-Swift/BlueSSLService#40 Enable decoupling of acceptClientConnection and delegate.onAccept 2017-09-14 13:32:20 +01:00
Quan Vo 558fdeb7b6 Swift 4 support 2017-08-23 11:36:57 -05:00