add ConnctionClose frame handling

This commit is contained in:
Marten Seemann
2016-04-16 00:15:13 +07:00
parent 4e5102216a
commit a2c4ebef19
3 changed files with 90 additions and 1 deletions

View File

@@ -114,11 +114,19 @@ func (s *Session) HandlePacket(addr *net.UDPAddr, publicHeaderBinary []byte, pub
return err
}
// ToDo: react to receiving this frame
} else if typeByte&0x02 == 0x02 { // CONNECTION_CLOSE
fmt.Println("Detected CONNECTION_CLOSE")
frame, err := ParseConnectionCloseFrame(r)
if err != nil {
return err
}
fmt.Printf("%#v\n", frame)
} else if typeByte == 0 {
// PAD
return nil
} else {
return errors.New("Session: invalid Frame Type Field")
}
return fmt.Errorf("Session: invalid frame type %x", typeByte)
}
return nil
}