Skip to content

Commit

Permalink
rename MarkUnreusable to MarkUnusable
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenghuabin committed Mar 25, 2015
1 parent a297624 commit 6bf1d0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func TestPool_Put(t *testing.T) {
}
}

func TestPool_PutUnreusableConn(t *testing.T) {
func TestPool_PutUnusableConn(t *testing.T) {
p, _ := newChannelPool()
defer p.Close()

Expand All @@ -138,7 +138,7 @@ func TestPool_PutUnreusableConn(t *testing.T) {
if pc, ok := conn.(*PoolConn); !ok {
t.Errorf("impossible")
} else {
pc.MarkUnreusable()
pc.MarkUnusable()
}
conn.Close()
if p.Len() != poolSize-1 {
Expand Down
8 changes: 4 additions & 4 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import "net"
type PoolConn struct {
net.Conn
c *channelPool
unreusable bool
unusable bool
}

// Close() puts the given connects back to the pool instead of closing it.
func (p PoolConn) Close() error {
if p.unreusable {
if p.unusable {
if p.Conn != nil {
p.Conn.Close()
}
Expand All @@ -22,8 +22,8 @@ func (p PoolConn) Close() error {
}

// MarkUnreusable() marks the connection is not reusable.
func (p *PoolConn) MarkUnreusable() {
p.unreusable = true
func (p *PoolConn) MarkUnusable() {
p.unusable = true
}

// newConn wraps a standard net.Conn to a poolConn net.Conn.
Expand Down

0 comments on commit 6bf1d0e

Please sign in to comment.