client: improve automatic protocol switching (#169)

(https://github.com/aler9/rtsp-simple-server/issues/1105)

when a camera receives a UDP request and replies with a TCP response,
switch protocol from UDP to TCP.
This commit is contained in:
Alessandro Ros
2023-01-19 09:41:24 +01:00
committed by GitHub
parent ca3ab98cca
commit 71bd86cff9
3 changed files with 222 additions and 6 deletions

View File

@@ -107,6 +107,22 @@ func (e ErrClientTransportHeaderInvalid) Error() string {
return fmt.Sprintf("invalid transport header: %v", e.Err)
}
// ErrClientServerRequestedTCP is an error that can be returned by a client.
type ErrClientServerRequestedTCP struct{}
// Error implements the error interface.
func (e ErrClientServerRequestedTCP) Error() string {
return "server wants to use the TCP transport protocol"
}
// ErrClientServerRequestedUDP is an error that can be returned by a client.
type ErrClientServerRequestedUDP struct{}
// Error implements the error interface.
func (e ErrClientServerRequestedUDP) Error() string {
return "server wants to use the UDP transport protocol"
}
// ErrClientTransportHeaderInvalidDelivery is an error that can be returned by a client.
type ErrClientTransportHeaderInvalidDelivery struct{}