(sock net.Conn, config *Config)
| 63 | } |
| 64 | |
| 65 | func 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 | |
| 83 | func (s *Session) CloseReaderWithError(err error) error { |
| 84 | s.exit.Do(func() { |
no test coverage detected