Commit 9d21478d authored by AlexStocks's avatar AlexStocks

Rem: do not use goroutine pool

parent 9c45b672
...@@ -27,7 +27,6 @@ import ( ...@@ -27,7 +27,6 @@ import (
import ( import (
"github.com/AlexStocks/goext/context" "github.com/AlexStocks/goext/context"
"github.com/AlexStocks/goext/runtime"
"github.com/AlexStocks/goext/sync" "github.com/AlexStocks/goext/sync"
"github.com/AlexStocks/goext/time" "github.com/AlexStocks/goext/time"
) )
...@@ -37,7 +36,6 @@ const ( ...@@ -37,7 +36,6 @@ const (
netIOTimeout = 1e9 // 1s netIOTimeout = 1e9 // 1s
period = 60 * 1e9 // 1 minute period = 60 * 1e9 // 1 minute
pendingDuration = 3e9 pendingDuration = 3e9
grPoolIdle = 10e9
defaultSessionName = "session" defaultSessionName = "session"
defaultTCPSessionName = "tcp-session" defaultTCPSessionName = "tcp-session"
defaultUDPSessionName = "udp-session" defaultUDPSessionName = "udp-session"
...@@ -83,9 +81,6 @@ type session struct { ...@@ -83,9 +81,6 @@ type session struct {
// goroutines sync // goroutines sync
grNum int32 grNum int32
lock sync.RWMutex lock sync.RWMutex
// goroutine pool
pool *gxruntime.Pool
} }
func newSession(endPoint EndPoint, conn Connection) *session { func newSession(endPoint EndPoint, conn Connection) *session {
...@@ -98,7 +93,6 @@ func newSession(endPoint EndPoint, conn Connection) *session { ...@@ -98,7 +93,6 @@ func newSession(endPoint EndPoint, conn Connection) *session {
period: period, period: period,
wait: pendingDuration, wait: pendingDuration,
attrs: gxcontext.NewValuesContext(nil), attrs: gxcontext.NewValuesContext(nil),
pool: gxruntime.NewGoroutinePool(grPoolIdle),
} }
ss.Connection.setSession(ss) ss.Connection.setSession(ss)
...@@ -495,9 +489,7 @@ LOOP: ...@@ -495,9 +489,7 @@ LOOP:
if flag { if flag {
log.Debug("%#v <-s.rQ", inPkg) log.Debug("%#v <-s.rQ", inPkg)
pkg := inPkg pkg := inPkg
s.pool.Go(func() { go s.listener.OnMessage(s, pkg)
s.listener.OnMessage(s, pkg)
})
s.incReadPkgNum() s.incReadPkgNum()
} else { } else {
log.Info("[session.handleLoop] drop readin package{%#v}", inPkg) log.Info("[session.handleLoop] drop readin package{%#v}", inPkg)
...@@ -518,15 +510,13 @@ LOOP: ...@@ -518,15 +510,13 @@ LOOP:
case <-wheel.After(s.period): case <-wheel.After(s.period):
if flag { if flag {
s.pool.Go(func() { if wsFlag {
if wsFlag { err := wsConn.writePing()
err := wsConn.writePing() if err != nil {
if err != nil { log.Warn("wsConn.writePing() = error{%s}", err)
log.Warn("wsConn.writePing() = error{%s}", err)
}
} }
s.listener.OnCron(s) }
}) s.listener.OnCron(s)
} }
} }
} }
...@@ -784,7 +774,6 @@ func (s *session) stop() { ...@@ -784,7 +774,6 @@ func (s *session) stop() {
conn.SetWriteDeadline(now.Add(s.writeTimeout())) conn.SetWriteDeadline(now.Add(s.writeTimeout()))
} }
close(s.done) close(s.done)
s.pool.Close()
}) })
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment