Comments (6)
Yes, I tried that one as well. The problem with that is, when I tested the ConnectionContext.Abort();
the server didn't receive the IsCompleted
nor the IsCancelled
result. You can check it for yourself, if you add logging at the start and at the end of the OnConnectedAsync()
method.
Though when I explicitly called the await connection.DisposeAsync();
, the server received the IsCompleted
result.
I created a PR for that: #130
from bedrockframework.
Im currently using ConnectionContext.Abort();
from bedrockframework.
Shouldnt BaseConnectionContext
also have a way of getting the connection state i.e if its closed, disconnected or connected?
Im currently using the cancellation token to see if the context should still be read from but it feels wrong.
I know you can use the features to get the socket state if the connection is a socket etc but surely the connection state of a "ConnectionContext" should be known independent of a transport?
public virtual CancellationToken ConnectionClosed
while (!connectionContext.ConnectionClosed.IsCancellationRequested)
{
await connectionSession.Reader.ReadAsync(_protocol);
var packet = result.Message;
//.... Handle packet ....
}
from bedrockframework.
Abort is the way to disconnect the transport for sure.
from bedrockframework.
@davidfowl In #130 PR. In the samples/ClientApplication/Program.cs at line 366, if I replace the await connection.DisposeAsync();
for connection.Abort();
nothing happens. The server won't receive IsCompleted
nor IsCancelled
result.
from bedrockframework.
Calling DisposeAsync to abort is incorrect. Calling Abort should work, if it doesn't work then there's a bug. DisposeAsync is implicitly called by the pipeline when the code unwinds.
from bedrockframework.
Related Issues (20)
- Can a single connection support writing in concurrent scenarios? HOT 1
- Blazor WASM support HOT 1
- Framing - Variable size length fielded protocol
- Out-of-Box BinarySerializer HOT 6
- How can use WebSocket (help wanted) HOT 1
- Connection closed when sending more than 126 bytes in a given message via WebSocket HOT 3
- How to make the server to disconnect all (or a specified) connected clients while keep running?
- Server Start-Stop "restart" exception HOT 1
- Disposable issues
- How to receive data correctly and how to close normally HOT 7
- Easily seeding user/roles for testing
- Question: SSL routines:tls_post_process_client_hello:no shared cipher
- Is Bedrock production ready? HOT 1
- MIDI Protocol - How to handle realtime, interleaved, messages
- DuplexPipeStream and Adapter Access
- Make `connection.CreateReader()` accept options. HOT 2
- Upgrade to .NET 7 HOT 6
- How do I use HubProtocol? I don't have invocationBinder.
- Question about using some code piece in `Server.cs` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bedrockframework.