MCPcopy
hub / github.com/CodisLabs/codis / NewSession

Function NewSession

pkg/proxy/session.go:65–81  ·  view source on GitHub ↗
(sock net.Conn, config *Config)

Source from the content-addressed store, hash-verified

63}
64
65func NewSession(sock net.Conn, config *Config) *Session {
66 c := redis.NewConn(sock,
67 config.SessionRecvBufsize.AsInt(),
68 config.SessionSendBufsize.AsInt(),
69 )
70 c.ReaderTimeout = config.SessionRecvTimeout.Duration()
71 c.WriterTimeout = config.SessionSendTimeout.Duration()
72 c.SetKeepAlivePeriod(config.SessionKeepAlivePeriod.Duration())
73
74 s := &Session{
75 Conn: c, config: config,
76 CreateUnix: time.Now().Unix(),
77 }
78 s.stats.opmap = make(map[string]*opStats, 16)
79 log.Infof("session [%p] create: %s", s, s)
80 return s
81}
82
83func (s *Session) CloseReaderWithError(err error) error {
84 s.exit.Do(func() {

Callers 1

serveProxyMethod · 0.85

Calls 4

SetKeepAlivePeriodMethod · 0.95
DurationMethod · 0.80
InfofMethod · 0.80
AsIntMethod · 0.45

Tested by

no test coverage detected