mirror of
https://github.com/openlibrecommunity/olcrtc.git
synced 2026-06-05 11:59:45 +00:00
fix(client): Move WaitForData call into loop and reduce timeout
This commit is contained in:
@@ -269,10 +269,11 @@ func (c *Client) handleSOCKS5(conn net.Conn) {
|
||||
|
||||
go func() {
|
||||
defer close(streamClosed)
|
||||
dataReady := c.mux.WaitForData(sid)
|
||||
defer c.mux.CleanupDataChannel(sid)
|
||||
|
||||
for {
|
||||
dataReady := c.mux.WaitForData(sid)
|
||||
|
||||
select {
|
||||
case <-done:
|
||||
return
|
||||
@@ -290,7 +291,14 @@ func (c *Client) handleSOCKS5(conn net.Conn) {
|
||||
if c.mux.StreamClosed(sid) {
|
||||
return
|
||||
}
|
||||
case <-time.After(100 * time.Millisecond):
|
||||
case <-time.After(10 * time.Millisecond):
|
||||
data := c.mux.ReadStream(sid)
|
||||
if len(data) > 0 {
|
||||
if _, err := conn.Write(data); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if c.mux.StreamClosed(sid) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user