Skip to content

Commit f8df91f

Browse files
committed
Check if pool is closed when getting a connection
1 parent 33ef340 commit f8df91f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

session.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,13 +347,17 @@ func (s *Session) noreplyWaitQuery() error {
347347

348348
return nil
349349
}
350-
func (s *Session) getConn() (Connection, error) {
350+
func (s *Session) getConn() (*Connection, error) {
351+
if s.pool == nil {
352+
return nil, pool.ErrClosed
353+
}
354+
351355
c, err := s.pool.Get()
352356
if err != nil {
353-
return Connection{}, err
357+
return nil, err
354358
}
355359

356-
return Connection{Conn: c, s: s}, nil
360+
return &Connection{Conn: c, s: s}, nil
357361
}
358362

359363
func (s *Session) checkCache(token int64) (*Cursor, bool) {

0 commit comments

Comments
 (0)