forked from quic-go/quic-go
don't panic! 🎉
This commit is contained in:
@@ -68,7 +68,7 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
utils.WriteUint32BigEndian(fullReply, QuicVersion32)
|
||||
_, err := conn.WriteToUDP(fullReply.Bytes(), remoteAddr)
|
||||
_, err = conn.WriteToUDP(fullReply.Bytes(), remoteAddr)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -80,6 +80,9 @@ func main() {
|
||||
session = quic.NewSession(conn, publicHeader.ConnectionID, serverConfig)
|
||||
sessions[publicHeader.ConnectionID] = session
|
||||
}
|
||||
session.HandlePacket(remoteAddr, data[0:n-r.Len()], publicHeader, r)
|
||||
err = session.HandlePacket(remoteAddr, data[0:n-r.Len()], publicHeader, r)
|
||||
if err != nil {
|
||||
fmt.Printf("Error handling packet: %s\n", err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package quic
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
|
||||
@@ -68,11 +69,11 @@ func (s *Session) HandlePacket(addr *net.UDPAddr, publicHeaderBinary []byte, pub
|
||||
|
||||
// TODO: Switch client messages here
|
||||
if messageTag != handshake.TagCHLO {
|
||||
panic("expected CHLO")
|
||||
return errors.New("Session: expected CHLO")
|
||||
}
|
||||
|
||||
if _, ok := cryptoData[handshake.TagPUBS]; ok {
|
||||
panic("received CHLO with PUBS")
|
||||
if _, ok := cryptoData[handshake.TagSCFG]; ok {
|
||||
return errors.New("Session: received CHLO with PUBS")
|
||||
}
|
||||
|
||||
proof, err := s.ServerConfig.Sign(frame.Data)
|
||||
|
||||
Reference in New Issue
Block a user