From e223ed73e607b3a50d15ac26dde3fef924a78406 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Fri, 15 Apr 2016 16:48:54 +0700 Subject: [PATCH] add very basic STOP_WAITING handling, return errors for unknown types --- session.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/session.go b/session.go index 95323c7fd..7dc7e1fcc 100644 --- a/session.go +++ b/session.go @@ -97,14 +97,13 @@ func (s *Session) HandlePacket(addr *net.UDPAddr, publicHeaderBinary []byte, pub continue // not yet implemented } else if typeByte&0xE0 == 0x20 { // CONGESTION_FEEDBACK - fmt.Println("Detected CONGESTION_FEEDBACK") - continue // not yet implemented + return errors.New("Detected CONGESTION_FEEDBACK") + } else if typeByte&0x06 == 0x06 { // STOP_WAITING + fmt.Println("Detected STOP_WAITING") + r.ReadByte() + r.ReadByte() } else { - fmt.Println("Detected invalid frame type. Not looking for any further frames in this packet.") - // at least one of the first three bits of the Type field has be 1 - // ToDo: sometimes there are packets that have this kind of "frame". Find out what's going wrong there. Ignore for the moment - // return errors.New("Session: invalid Frame Type Field") - break + return errors.New("Session: invalid Frame Type Field") } } return nil