ing
This commit is contained in:
parent
1104f7e270
commit
d13384841b
|
@ -63,7 +63,7 @@ func (s *server) Stop() {
|
|||
close(s.stopChan)
|
||||
s.stopWg.Wait()
|
||||
s.stopChan = nil
|
||||
s.serverHandler.Stopped()
|
||||
s.serverHandler.OnStopped()
|
||||
}
|
||||
|
||||
func (s *server) Serve() error {
|
||||
|
|
|
@ -8,7 +8,9 @@ import (
|
|||
type ServerHandler interface {
|
||||
Listen() (net.Listener, error)
|
||||
Handle(remoteAddr string, rwc io.ReadWriteCloser, stopChan chan struct{})
|
||||
Stopped()
|
||||
OnStopped()
|
||||
|
||||
IsClientDisconnect(err error) bool
|
||||
|
||||
GetAddr() string
|
||||
|
||||
|
|
|
@ -54,7 +54,11 @@ func (sh *ServerHandlers) Handle(remoteAddr string, rwc io.ReadWriteCloser, stop
|
|||
|
||||
}
|
||||
|
||||
func (sh *ServerHandlers) Stopped() {
|
||||
func (sh *ServerHandlers) IsClientDisconnect(err error) bool {
|
||||
return err == io.ErrUnexpectedEOF || err == io.EOF
|
||||
}
|
||||
|
||||
func (sh *ServerHandlers) OnStopped() {
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user