573df2e7 by astaxie

add isclose call close many times

1 parent aa9cb6d0
...@@ -27,12 +27,16 @@ var ErrInitStart = errors.New("init from") ...@@ -27,12 +27,16 @@ var ErrInitStart = errors.New("init from")
27 // Allows for us to notice when the connection is closed. 27 // Allows for us to notice when the connection is closed.
28 type conn struct { 28 type conn struct {
29 net.Conn 29 net.Conn
30 wg *sync.WaitGroup 30 wg *sync.WaitGroup
31 isclose bool
31 } 32 }
32 33
33 func (c conn) Close() error { 34 func (c conn) Close() error {
34 err := c.Conn.Close() 35 err := c.Conn.Close()
35 c.wg.Done() 36 if !c.isclose {
37 c.wg.Done()
38 c.isclose = true
39 }
36 return err 40 return err
37 } 41 }
38 42
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!