Skip to content

Commit 4175740

Browse files
author
iwysiu
committed
GODRIVER-1323 cleanup connection close logic (#183)
1 parent 7cb4923 commit 4175740

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

x/mongo/driver/topology/connection.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,8 @@ func (c *Connection) Close() error {
431431
defer c.s.sem.Release(1)
432432
}
433433
err := c.pool.put(c.connection)
434-
if err != nil {
435-
return err
436-
}
437434
c.connection = nil
438-
return nil
435+
return err
439436
}
440437

441438
// Expire closes this connection and will closeConnection the underlying socket.
@@ -449,11 +446,8 @@ func (c *Connection) Expire() error {
449446
c.s.sem.Release(1)
450447
}
451448
err := c.close()
452-
if err != nil {
453-
return err
454-
}
455449
c.connection = nil
456-
return nil
450+
return err
457451
}
458452

459453
// Alive returns if the connection is still alive.

0 commit comments

Comments
 (0)