-
Notifications
You must be signed in to change notification settings - Fork 215
Open
Description
看了一下代码,不是很有信心能改对:
--- 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels