server: add missing check

This commit is contained in:
aler9
2021-10-30 21:57:07 +02:00
parent cab3fe270e
commit 235cc4061b

View File

@@ -68,7 +68,7 @@ type Server struct {
// //
// handler // handler
// //
// an handler interface to handle requests. // an handler to handle server events.
Handler ServerHandler Handler ServerHandler
// //
@@ -184,7 +184,11 @@ func (s *Server) Start(address string) error {
} }
if s.TLSConfig != nil && s.UDPRTPAddress != "" { if s.TLSConfig != nil && s.UDPRTPAddress != "" {
return fmt.Errorf("TLS can't be used together with UDP") return fmt.Errorf("TLS can't be used with UDP")
}
if s.TLSConfig != nil && s.MulticastIPRange != "" {
return fmt.Errorf("TLS can't be used with UDP-multicast")
} }
if (s.UDPRTPAddress != "" && s.UDPRTCPAddress == "") || if (s.UDPRTPAddress != "" && s.UDPRTCPAddress == "") ||
@@ -292,14 +296,14 @@ func (s *Server) Start(address string) error {
} }
// Close closes all the server resources. // Close closes all the server resources.
// It doesn't wait for the server resources to shut down (use Wait for that). // It doesn't wait for the server resources to close (use Wait for that).
func (s *Server) Close() error { func (s *Server) Close() error {
s.ctxCancel() s.ctxCancel()
return nil return nil
} }
// Wait waits until all server resources are shut down. // Wait waits until all server resources are closed.
// This can happen in case of a fatal error or when Close() is called. // This can happen when a fatal error occurs or when Close() is called.
func (s *Server) Wait() error { func (s *Server) Wait() error {
s.wg.Wait() s.wg.Wait()
return s.exitError return s.exitError