Commit graph

61 commits

Author SHA1 Message Date
WebFreak001 bc3b319783 Fix potential crash if context is null on closed socket
If the other side closes the connection this might happen
Without this check the following m_context.readBuffer would segfault
2018-12-20 02:20:41 +01:00
WebFreak001 c8ab6ae2f8 Make waitForData not assert fail on close fix #110 2018-12-20 02:10:40 +01:00
Sönke Ludwig 897fee84ea Free resources associated with waitForDataAsync as early as possible.
Instead of letting the GC clean up at an undefined point in time.
2018-09-03 13:45:53 +02:00
Sönke Ludwig 0b638634c9 Fix waitForDataAsync compilation error for callbacks that have scoped destruction. 2018-09-03 12:35:05 +02:00
Boris-Barboris eea57f8914 MonoTime in loopWithTimeout, and other read tweaks.
MonoTime is more robust and does not involve sophisticated timezone
shenanigans, making it better suited for networking operations.
Fixes #39.
This commit also distinguishes read timeout exception as Exception child
ReadTimeoutException, wich is thrown from loopWithTimeout function.
Optimistic read branch for tcp socket improves performance on
granular reads.
2018-03-23 06:45:05 +00:00
Sönke Ludwig e2eef799f8 Fix cancellation of connectTCP in case of early errors.
Certain errors will result in an invalid handle to be returned from eventDriver.sockets.connectStream. In that case it is invalid to call cancelConnect.

Also adds an additional debug log message including a stack trace in case of exceptions thrown from connection handlers.
2018-03-18 12:13:13 +01:00
Sönke Ludwig 2c63aa5c5c Allow destructors to run in foreign threads. Fixes #69.
This change modifies destructors to anticipate that they can be called form a foreign thread if the GC is involved. The actual release of the reference will then happen deferred in the original thread.
2018-03-16 18:06:53 +01:00
Sönke Ludwig eb3620056f Ensure async lambdas are templates to fix LDC linker errors. Fixes #65.
If the lambda is a concrete function, two different versions will end up for it in the final binary on macOS when compiled with LDC. Using argument inference works around that issue.
2018-03-08 14:24:22 +01:00
Sönke Ludwig 57d516a82b
fixup 2018-02-26 19:40:13 +01:00
Sönke Ludwig e33cf567ec
Change callback semantics of waitForDataAsync
Also adds a documentation comment to specify the semantics.
2018-02-26 13:15:24 +01:00
Francesco Mecca 99e2873cc0 assert and stronger condition on TCPConnection.waitForDataAsync
assert and stronger condition on TCPConnection.waitForDataAsync
2018-02-24 21:32:54 +01:00
Francesco Mecca 20e32cf327 added Timer and enum return to TCPConnection.waitForDataAsync 2018-02-23 00:27:04 +00:00
Francesco Mecca 0d6ba62f51 added TCPConnection.waitForDataAsync 2018-02-21 22:17:18 +00:00
Pavel Chebotarev 13e6c2aa41 Fix incorrect return value in TCPConnection.leastSize() 2018-01-27 18:53:16 +03:00
Martin Nowak 30102f9e3a avoid Buffer type which creates a huge __initZ symbol 2018-01-14 04:43:14 +01:00
Sönke Ludwig 2625397f91 Use asyncAwaitAny instead of asyncAwait to work around linker error. 2017-11-25 15:27:17 +01:00
Boris-Barboris 6634cbc645 switch to asyncAwait 2017-11-25 15:27:17 +01:00
Boris-Barboris 55e7866497 implement tcp connect timeout 2017-11-25 15:27:17 +01:00
Sönke Ludwig db449e3cb3 Fix implementation of TCPListener.bindAddress. 2017-09-28 23:52:39 +02:00
Sönke Ludwig 9fe9783443 Convert Waitable from struct to pure template to avoid heap closures.
Also fixes a case where ThreadLocalWaiter.emitSingle overlaps a call to .emit.
2017-09-27 16:41:11 +02:00
Sönke Ludwig 8895f62a49
Fix parameter name. 2017-09-15 15:58:35 +02:00
Sönke Ludwig 333643d48e Add interface_address parameter to UDPConnection.addMembership. 2017-09-15 15:54:59 +02:00
Sönke Ludwig 2d0576a5fe
Implement the UDP multicast support methods. 2017-09-03 18:15:52 +02:00
Sönke Ludwig 7e1d6a7323 Add listenUDP overload taking a NetworkAddress. 2017-09-03 15:54:17 +02:00
Sönke Ludwig f81c9175df
Mention that TCPListenOptions.distribute is deprecated. 2017-07-20 18:48:08 +02:00
Sönke Ludwig d39bbf19c0
Avoid extra exception and allow toString of unspecified NetworkAddress values. 2017-07-19 14:50:20 +02:00
Sönke Ludwig d7b2173cb3 Implement TCPListener.stopListening and fix the vibe.core.net.1726 test.
The test fix follows the fix in the vibe.d repository: rejectedsoftware/vibe.d#f960427e5974c176c58b516647895a2af4ea181b
2017-07-18 11:55:39 +02:00
Sönke Ludwig ca2f9dbe91 Add UDP multicast declarations matching rejectedsoftware/vibe.d#1806.
The actual functionality still needs to be implemented in eventcore.
2017-07-08 10:44:42 +02:00
Sebastian Wilzbach 04b3575c14 Remove deprecated stdc import 2017-07-03 00:39:41 +02:00
Sönke Ludwig 01ed0a43de Adjust for eventcore 0.8.12. 2017-06-27 01:11:50 +02:00
Sönke Ludwig e3f9d07e58
Don't store local/remote address for UDP connections.
Errored out due to the space requirements of UNIX addresses.
2017-03-10 23:00:43 +01:00
Sönke Ludwig 5fd9fc4007
Always compute TCPConnection.xxxAddress on demand.
Storing the network addresses becomes too expensive with UNIX socket support.
2017-03-10 21:06:18 +01:00
Sönke Ludwig ed8b33786b
Compile fixes. 2017-03-10 20:07:04 +01:00
Sönke Ludwig 1edfc88e63 Add UNIX address type support to NetworkAddress. 2017-03-10 19:53:40 +01:00
Sönke Ludwig 72913575f4
Fix error message. 2017-01-30 22:52:36 +01:00
Sönke Ludwig b7e996cd8c
Let TCPConnection.peek() handle closed connections gracefully. 2017-01-30 17:27:43 +01:00
Sönke Ludwig 2dccd43277
Let TCPConnection.waitForData amd leastSize act gracefully on closed connections. 2017-01-30 12:04:21 +01:00
Sönke Ludwig ac811ba501
Remove buggy NetworkAddress.toUnknownAddress.
UnknownAddress is not large enough to hold either IPv6 or UDS addresses.
2017-01-30 11:40:11 +01:00
Sönke Ludwig d2629ef053
Don't throw on read error in TCPConnection.waitForData. 2017-01-30 11:29:01 +01:00
Sönke Ludwig 4c9b6c0fb8
Properly check return value of createDatagramSocket. 2017-01-30 11:19:51 +01:00
Sönke Ludwig 84a21f7e9d
Add compatibility overloads for listenTCP. 2017-01-30 09:19:08 +01:00
Sönke Ludwig 96b798200c
Make more network methods nothrow.
TCPConection properties and NetworkAddress.to(Address)String have been marked nothrow.
2017-01-29 20:19:38 +01:00
Sönke Ludwig 798f0ef446
Implement support for TCPListenOptions.reusePort. 2017-01-27 22:51:17 +01:00
Sönke Ludwig 5249c1c4c6
Fix infinite recursion in TCPConnection.(local/remote)Address properties. 2017-01-26 13:58:14 +01:00
Sönke Ludwig 2acc60934f
Add IOMode parameters to stream read/write methods. 2017-01-19 00:36:32 +01:00
Sönke Ludwig 9d4e8086ff Make the callback type the first argument to Waitable!(). 2017-01-16 00:23:37 +01:00
Sönke Ludwig 964d72f3b5 Fix handling of scoped callback parameters in eventcore callbacks. 2017-01-16 00:20:35 +01:00
Sönke Ludwig f3c84d497e Fix bind address handling for connectTCP. 2017-01-15 23:17:14 +01:00
Sönke Ludwig 24b940039d Implement UDPConnection.canBroadcast/localAddress. 2017-01-15 22:19:41 +01:00
Sönke Ludwig f015662a94 TCPConnection and async improvements.
- asyncAwaitAny now takes the callback type, so that parameter storage classes are handled correctly
- Implement TCPConnection.remoteAddress/localAddress
- Implement TCPConnection.tcpNoDelay, keepAlive and readTimeout
- Implement timeout handling for TCPConnection.waitForData
2017-01-15 20:59:36 +01:00