From 1a3e6ad092d7ae7f1bce16e92d56d9012fe06d07 Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Mon, 14 Aug 2023 11:07:52 +0200 Subject: [PATCH] remove return value from Close() --- .golangci.yml | 5 ----- client.go | 5 +---- server.go | 5 +---- server_conn.go | 4 +--- server_session.go | 4 +--- server_stream.go | 5 +---- 6 files changed, 5 insertions(+), 23 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 593d6b20..ef8821e8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -52,11 +52,6 @@ linters-settings: - (github.com/datarhei/gosrt.Conn).Close - (github.com/datarhei/gosrt.Conn).SetReadDeadline - (github.com/datarhei/gosrt.Conn).SetWriteDeadline - - (*github.com/bluenviron/gortsplib/v4.Client).Close - - (*github.com/bluenviron/gortsplib/v4.Server).Close - - (*github.com/bluenviron/gortsplib/v4.ServerSession).Close - - (*github.com/bluenviron/gortsplib/v4.ServerStream).Close - - (*github.com/bluenviron/gortsplib/v4.ServerConn).Close govet: enable-all: true diff --git a/client.go b/client.go index b71fe76c..f572ab5a 100644 --- a/client.go +++ b/client.go @@ -461,12 +461,9 @@ func (c *Client) StartRecording(address string, medias media.Medias) error { } // Close closes all client resources and waits for them to close. -func (c *Client) Close() error { +func (c *Client) Close() { c.ctxCancel() <-c.done - - // TODO: remove return value in next major version - return c.closeError } // Wait waits until all client resources are closed. diff --git a/server.go b/server.go index 98394206..0fef65f2 100644 --- a/server.go +++ b/server.go @@ -318,12 +318,9 @@ func (s *Server) Start() error { } // Close closes all the server resources and waits for them to close. -func (s *Server) Close() error { +func (s *Server) Close() { s.ctxCancel() s.wg.Wait() - - // TODO: remove return value in next major version - return s.closeError } // Wait waits until all server resources are closed. diff --git a/server_conn.go b/server_conn.go index 2132ee83..13b9bc9a 100644 --- a/server_conn.go +++ b/server_conn.go @@ -110,10 +110,8 @@ func newServerConn( } // Close closes the ServerConn. -func (sc *ServerConn) Close() error { +func (sc *ServerConn) Close() { sc.ctxCancel() - // TODO: remove return value in next major version - return nil } // NetConn returns the underlying net.Conn. diff --git a/server_session.go b/server_session.go index bbd3175b..567d2bfb 100644 --- a/server_session.go +++ b/server_session.go @@ -195,10 +195,8 @@ func newServerSession( } // Close closes the ServerSession. -func (ss *ServerSession) Close() error { +func (ss *ServerSession) Close() { ss.ctxCancel() - // TODO: remove return value in next major version - return nil } // BytesReceived returns the number of read bytes. diff --git a/server_stream.go b/server_stream.go index 96ba59e6..916c0028 100644 --- a/server_stream.go +++ b/server_stream.go @@ -56,7 +56,7 @@ func (st *ServerStream) initializeServerDependentPart() { } // Close closes a ServerStream. -func (st *ServerStream) Close() error { +func (st *ServerStream) Close() { st.mutex.Lock() st.closed = true st.mutex.Unlock() @@ -68,9 +68,6 @@ func (st *ServerStream) Close() error { for _, sm := range st.streamMedias { sm.close() } - - // TODO: remove return value in next major version - return nil } // Medias returns the medias of the stream.