-
Notifications
You must be signed in to change notification settings - Fork 6
Full duplex Ws transfer using channels #110
base: develop
Are you sure you want to change the base?
Conversation
Use channels to pump messages
instead of (RspHeader Response, NtyHeader Notify, int Offset) tuple
clips the length of a span the the maximum length
Listens for Messages and dispatches them by their headers to different handlers.
Remove useless DisposeAsync
Remove useless DisposeAsync
# Conflicts: # src/Common/WsStream.cs # src/Ws/Ws.cs # tests/Driver.Tests/DatabaseTests.cs
Debug logging shows, that sometimes the
At some point the debug log stops, the line is not written to the end. The log is disposed by the I observed, that the softlock only ever occurs at the last block of the last message in the unit test. Note that the code is followed by a // log that we are waiting for the socket
log.SocketWaiting();
// receive the first part
var result = await _socket.ReceiveAsync(buffer, ct).Inv();
// log that we have received a message from the socket
log.SockedReceived(result);
ct.ThrowIfCancellationRequested(); Why the |
For now I reorder the |
Creates one channel for receiving (tx - server transfer). The channel has a associated producer and consumer.
Significant members
WsRx
ClientWebSocket
WsTxConsumer
WsTxProvider
ClientWebSocket
and pumps the tx channel with messages. Messages can consist of multiple blocks, and are streamed. They are pumped as soon as the first part arrives.WsMessageReader
handles multipart messages.To-Do
WsMessageReader
use a custom channel implementation, that is unbound, disposable using a pooled array.WsMessageReader
can be replaced with memory barriers of some kind.RecyclableMemoryManagerManager
is too aggressive.Postscriptum: I kind of bricked my IDE by debugging tests, so I am clearly doing sth wrong kek
Postpostscriptum: Still in development, sometimes a message gets lost...
Postpostpostscriptum: thats what I get for cheating the initial implementation...