Commit 71adbdd7 authored by astaxie's avatar astaxie

add mutex

parent 573df2e7
......@@ -29,9 +29,12 @@ type conn struct {
net.Conn
wg *sync.WaitGroup
isclose bool
lock sync.Mutex
}
func (c conn) Close() error {
c.lock.Lock()
defer c.lock.Unlock()
err := c.Conn.Close()
if !c.isclose {
c.wg.Done()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment