Skip to content

Commit 4dc6dd0

Browse files
committed
refactor(handler): start sub-goroutine via routine to replicate the goroutine's context
1 parent 893bf52 commit 4dc6dd0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cluster/handler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"github.com/lonng/nano/protocal/packet"
2222
"github.com/lonng/nano/scheduler/schedulerapi"
2323
"github.com/lonng/nano/session"
24+
"github.com/timandy/routine"
2425
)
2526

2627
type rpcHandler func(session *session.Session, msg *message.Message, noCopy bool)
@@ -184,7 +185,7 @@ func (h *LocalHandler) handle(conn net.Conn) {
184185
}()
185186

186187
// startup write goroutine
187-
go agt.write()
188+
routine.Go(agt.write)
188189

189190
if env.Debug {
190191
log.Info("New session established: %s", agt.String())

0 commit comments

Comments
 (0)