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
看了一下代码,不是很有信心能改对:
--- a/session.go +++ b/session.go @@ -325,10 +325,11 @@ func (s *Session) recvLoop() { // read header first if _, err := io.ReadFull(s.conn, hdr[:]); err == nil { atomic.StoreInt32(&s.dataReady, 1) - if hdr.Version() != byte(s.config.Version) { + if !(hdr.Version() == byte(1) || hdr.Version() == byte(2)) { s.notifyProtoError(ErrInvalidProtocol) return } + s.config.Version = int(hdr.Version()) sid := hdr.StreamID() switch hdr.Cmd() { case cmdNOP:
server 能否通过这样自动适配客户端的协议版本? @xtaci
The text was updated successfully, but these errors were encountered:
嗯,貌似是可以的。
Sorry, something went wrong.
多谢,试了一下,真的可以。还有一个地方要改,保证每个 session 用独立的 Config:
--- a/mux.go +++ b/mux.go @@ -94,7 +94,8 @@ func Server(conn io.ReadWriteCloser, config *Config) (*Session, error) { if err := VerifyConfig(config); err != nil { return nil, err } - return newSession(config, conn, false), nil - + cloneConfig := *config + return newSession(&cloneConfig, conn, false), nil }
觉得就像是个 trick,等大佬更新。
No branches or pull requests
看了一下代码,不是很有信心能改对:
server 能否通过这样自动适配客户端的协议版本?
@xtaci
The text was updated successfully, but these errors were encountered: