ing
This commit is contained in:
parent
b630f1721c
commit
64216d22c4
|
@ -135,7 +135,7 @@ func (s *server) handleRequest(ctx *fasthttp.RequestCtx) {
|
|||
soc := newSocket(conn, socketHandler)
|
||||
|
||||
s.stopWg.Add(1)
|
||||
handleConnection(s, soc)
|
||||
handleConnection(s, soc, socketHandler)
|
||||
})
|
||||
|
||||
}
|
||||
|
@ -147,14 +147,14 @@ func (s *server) handleError(ctx *fasthttp.RequestCtx, status int, reason error)
|
|||
s.sh.OnError(ctx, status, reason)
|
||||
}
|
||||
|
||||
func handleConnection(s *server, soc *Socket) {
|
||||
func handleConnection(s *server, soc *Socket, socketHandler SocketHandler) {
|
||||
defer s.stopWg.Done()
|
||||
|
||||
logging.Logger.Debug(fmt.Sprintf("Server: Client[%s] is connected.", soc.RemoteAddr()))
|
||||
clientStopChan := make(chan struct{})
|
||||
handleDoneChan := make(chan struct{})
|
||||
|
||||
go soc.sh.Handle(soc, clientStopChan, handleDoneChan)
|
||||
go socketHandler.Handle(soc, clientStopChan, handleDoneChan)
|
||||
|
||||
select {
|
||||
case <-s.stopChan:
|
||||
|
|
Loading…
Reference in New Issue
Block a user