Danny Sung
4dd6c81f28
travis: update CI environments ( #202 )
...
* travis: update CI environments
* Add BlueSocketTestCommonLibrary, BlueSocketTestClient, BlueSocketTestServer
- Add a library component to make it easier to do tests and profiling under streaming loads (multiple client connections, lots of data, etc.)
* Removed Swift 4.x, bumped minimum swift version requirement to 5.1
* keep build at Swift 5.0; update CI to only test from 5.1.5 on up
* Only attempt to build command-line for Swift 5.2+
* Ensure tools and dependencies only build for Swift 5.2+
* Address various lint errors
* Update README with version details and latest iOS related issues
2021-06-16 22:18:24 -07:00
David Jones
0830287874
Resolve compile warnings in future versions of Swift
2019-10-01 09:46:08 +01:00
Bill Abt
49cab699e9
Minor format changes and adding of additional comments.
2019-08-27 10:18:21 -04:00
Lei Zhang
0d37c602eb
Fix the retrieve of the UNIX address as an UnsafeMutablePointer for big endian
2019-08-16 10:54:55 -07:00
David Jones
2973532ec9
Resolve Swift 5 compile warnings
2019-04-04 12:02:17 +01:00
Bill Abt
48a77e2e35
Documentation quality and consistency improvements.
2018-12-14 10:56:36 -05:00
Bill Abt
b911b29416
When attempting to connect a socket that is already connected, the error code being returned was correct but the error message text that was being returned was the exact opposite of the actual error.
2018-12-14 09:53:41 -05:00
Bill Abt
9dc3e45be9
Minor code change to use the nil coalescing to improve readability. Improved internal documentation to call out specific notations supported.
2018-12-14 08:42:35 -05:00
Bill Abt
9d77d6b212
Added new parameter to TCP version of listen API to allow caller to specify a particular address to listen on. This new parameter is defaulted to nil and therefore should affect current callers.
2018-12-13 11:00:56 -05:00
Bill Abt
0e30af1d7d
Fixed buffer overflow problem that only showed up in optimized code.
2018-09-28 17:59:34 -04:00
Bill Abt
8dfecd3df6
Minor formatting changes. Added additional documentation.
2018-09-04 10:27:50 -04:00
Fred Cox
cdfa5bc882
No need to use fallthrough in this switch
2018-08-30 15:07:41 +03:00
Fred Cox
114f6b98ea
Set remoteConnectionClosed = true for all ECONNRESET
2018-08-30 15:04:47 +03:00
Fred Cox
a4ffe7e027
Rearrange connect(using signature: Signature) to use address if its set before hostname
...
Also allow creating a Signature with Address and hostname
In this case the hostname is only used for SSL verification as the address is already resolved
2018-08-30 12:27:29 +03:00
Fred Cox
dedea0de3a
Allow creating signature from Address
2018-08-30 12:18:33 +03:00
Ian Partridge
103e4ec265
Update comment
2018-08-01 13:11:25 +01:00
Ian Partridge
6eec5f8d44
Initialize readBuffer with to:
2018-07-30 17:10:05 +01:00
Bouke Haarsma
ede2b21dce
Make connect() work for UDP sockets as well
2018-06-03 08:18:05 +02:00
Shihab-Mehboob1
d368504ecd
Added descriptive error reasons
2018-04-12 10:36:13 +01:00
Bill Abt
8ce3961e63
Added new parameter to connect() to allow the caller to force the connection to the specific family of the Socket instance making call. The default behavior is to allow connection to any socket family.
2018-04-09 10:21:39 -04:00
Bill Abt
db43361274
When calling getaddrinfo(), the hints variable should reflect the protocol family of the socket. Thanks @lucJW.
2018-04-05 10:46:54 -04:00
Jim Dovey
c8ee463a06
Makes sure that the temporary socket opened in Socket.connect(to:port:timeout:) is closed in the event of an error being thrown.
...
I've added two pieces here: first is a `defer` block right after the creation of the `socketDescriptor` variable. If it's non-nil and not `Socket.SOCKET_INVALID_DESCRIPTOR` then the socket is closed pronto. Secondly, I'm explicitly setting this variable to `nil` when it's copied into `self.socketfd`. From that point on, any failure or error thrown will not result in the socket being orphaned, since it's referenced by the `Socket` class instance, and will be cleaned up in its `deinit` implementation.
2018-02-22 13:08:31 -08:00
Bill Abt
f49d9dabdb
Changed to use new SSLError initializer that was changed to accommodate changes in Swift 4.1.
2018-02-21 10:50:39 -05:00
Bill Abt
8f31fff919
Merge pull request #121 from IBM-Swift/issue.swift41
...
Update to support Swift 4.1
2018-02-21 10:19:22 -05:00
ShihabMehboob
fd15ef5d44
Squashed commit of the following:
...
commit d658dc3618946a6d295f1604fb8a8378d8d3f1f6
Author: ShihabMehboob <shihab.mehboob1@ibm.com >
Date: Wed Feb 14 13:18:31 2018 +0000
Updates to Swift 4.1
commit fc48ea6a203914081a060424d79af89a96578c7b
Author: ShihabMehboob <shihab.mehboob1@ibm.com >
Date: Wed Feb 14 13:14:17 2018 +0000
Updates to Swift 4.1
commit 3f2c276c247aa4d97a52a65eae0804fa3028261b
Author: ShihabMehboob <shihab.mehboob1@ibm.com >
Date: Wed Feb 14 13:13:56 2018 +0000
Updates to Swift 4.1
commit 664e5ce38c679498a8f35a7adbc22beb70cd08b4
Author: ShihabMehboob <shihab.mehboob1@ibm.com >
Date: Wed Feb 14 13:11:01 2018 +0000
Updates to Swift 4.1
commit 985ea641cbbb1cc7d37a8aa1a19ca019221f0b81
Author: ShihabMehboob <shihab.mehboob1@ibm.com >
Date: Wed Feb 14 12:52:38 2018 +0000
Updates to Swift 4.1
commit 1f74bb681948aca741c3dec025f73aa341efef0f
Author: ShihabMehboob <shihab.mehboob1@ibm.com >
Date: Mon Feb 12 10:27:00 2018 +0000
Support Swift 4.1
commit c86c534b84fb0fcee04030ae948650ab3f5e78df
Author: ShihabMehboob <shihab.mehboob1@ibm.com >
Date: Thu Feb 8 13:59:20 2018 +0000
Support Swift 4.1
2018-02-14 13:20:55 +00:00
Bill Abt
c8c1a1e9c1
Throw an exception if connect is called on a non-blocking socket without a timeout being passed. Updated documentation to reflect this.
2018-02-13 11:22:34 -05:00
Jim Dovey
fec7cf7438
Fixed the bug in the new fd_set implementation on macOS.
2018-01-26 16:49:44 -08:00
Bill Abt
d3c5ff3ecd
Rollback the fd_set extension changes from PR #107 to the original. The changes were causing a crash bug whenever the new fd_set extensions were called.
2018-01-22 10:32:30 -05:00
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
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
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
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