Skip to content
New issue

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

服务端恢复session时,恢复rcv_nxt(让服务端可以继续read)是否可行 #267

Open
ianzhang1988 opened this issue May 8, 2024 · 0 comments

Comments

@ianzhang1988
Copy link

发现下面的代码在服务端重启时,客户端上报的sn和服务端的rcv_nxt不一致,导致服务端恢复的连接无法read客户端数据。

在代码增加恢复服务端rcv_nxt是否可行呢?(下面代码注释部分)

https://github.com/xtaci/kcp-go/blob/e026777b9cb8afa9ce8a963f3e54ffccaf03f6a1/sess.go#L838C3-L847C4

                if s == nil && convRecovered { // new session
                        if len(l.chAccepts) < cap(l.chAccepts) { // do not let the new sessions overwhelm accept queue
                                s := newUDPSession(conv, l.dataShards, l.parityShards, l, l.conn, false, addr, l.block)
                                s.kcpInput(data)
                                // s.kcp.rcv_nxt = sn // 这里可以使恢复的连接继续接受客户端数据
                                l.sessionLock.Lock()
                                l.sessions[addr.String()] = s
                                l.sessionLock.Unlock()
                                l.chAccepts <- s
                        }
                }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant