[PD1] log fixing
This commit is contained in:
parent
d6b8ed48a6
commit
f5b3726673
6 changed files with 79 additions and 37 deletions
|
@ -20,7 +20,7 @@ func NewServer[T any](serverTLSConfigProvider ServerTLSConfigProvider, port int)
|
|||
|
||||
listener, err := tls.Listen("tcp", fmt.Sprintf("0.0.0.0:%d", port), serverTLSConfigProvider.GetServerTLSConfig())
|
||||
if err != nil {
|
||||
panic("Server could not bind to address")
|
||||
log.Fatalln("Server could not bind to address")
|
||||
}
|
||||
return Server[T]{
|
||||
listener: listener,
|
||||
|
@ -33,17 +33,17 @@ func (s *Server[T]) ListenLoop() {
|
|||
for {
|
||||
listenerConn, err := s.listener.Accept()
|
||||
if err != nil {
|
||||
panic("Server could not accept connection")
|
||||
log.Fatalln("Server could not accept connection")
|
||||
}
|
||||
tlsConn, ok := listenerConn.(*tls.Conn)
|
||||
if !ok {
|
||||
panic("Connection is not a TLS connection")
|
||||
log.Fatalln("Connection is not a TLS connection")
|
||||
}
|
||||
tlsConn.Handshake()
|
||||
|
||||
state := tlsConn.ConnectionState()
|
||||
if len(state.PeerCertificates) == 0 {
|
||||
log.Panicln("Client did not provide a certificate")
|
||||
log.Fatalln("Client did not provide a certificate")
|
||||
}
|
||||
conn := NewConnection[T](tlsConn)
|
||||
s.C <- conn
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue