diff --git a/server_handler.go b/server_handler.go index 3ed7127..cd9f06a 100644 --- a/server_handler.go +++ b/server_handler.go @@ -13,7 +13,5 @@ type ServerHandler interface { Handle(conn net.Conn, stopChan <-chan struct{}, doneChan chan<- struct{}) - IsClientDisconnect(err error) bool - Validate() } diff --git a/server_handlers.go b/server_handlers.go index fe7e2b7..6a2e46c 100644 --- a/server_handlers.go +++ b/server_handlers.go @@ -2,7 +2,6 @@ package server import ( "errors" - "io" "log" "net" ) @@ -30,10 +29,6 @@ func (sh *ServerHandlers) Handle(conn net.Conn, stopChan <-chan struct{}, doneCh log.Printf("Server.Handle") } -func (sh *ServerHandlers) IsClientDisconnect(err error) bool { - return err == io.ErrUnexpectedEOF || err == io.EOF -} - func (sh *ServerHandlers) Validate() { } diff --git a/util.go b/util.go new file mode 100644 index 0000000..ecb2790 --- /dev/null +++ b/util.go @@ -0,0 +1,7 @@ +package server + +import "io" + +func IsClientDisconnect(err error) bool { + return err == io.ErrUnexpectedEOF || err == io.EOF +}