We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
服务器主动连接客户端,发送数据。那么谁负责关这个虚拟连接? 客户端不知道服务器什么时候把数据发完,那看起来是应该服务器来主动关。 服务器关的话有个问题是 连接关闭的优先级比数据包处理优先级高。
// server conn = Server.Dial(clientId) conn.Send(data) conn.Close()
在客户端侧,数据包是塞队列里面等 Receive 的,但实际去 Receive 的时候 Conn 可能已经被标记 close 了。
workaround 想法
diff --git a/csharp/Fastway/EndPoint.cs b/csharp/Fastway/EndPoint.cs index a961610..fd9817d 100644 --- a/csharp/Fastway/EndPoint.cs +++ b/csharp/Fastway/EndPoint.cs @@ -38,13 +38,13 @@ namespace Fastway public byte[] Receive () { lock (this) { + if (this.waitRecv.Count > 0) + return this.waitRecv.Dequeue (); + if (this.closed) return null; - - if (this.waitRecv.Count == 0) - return NoMsg; - - return this.waitRecv.Dequeue (); + + return NoMsg; } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
服务器主动连接客户端,发送数据。那么谁负责关这个虚拟连接?
客户端不知道服务器什么时候把数据发完,那看起来是应该服务器来主动关。
服务器关的话有个问题是 连接关闭的优先级比数据包处理优先级高。
在客户端侧,数据包是塞队列里面等 Receive 的,但实际去 Receive 的时候 Conn 可能已经被标记 close 了。
workaround 想法
The text was updated successfully, but these errors were encountered: