1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 13:50:54 +00:00

add isclose call close many times

This commit is contained in:
astaxie 2013-06-26 22:13:25 +08:00
parent aa9cb6d052
commit 573df2e747

View File

@ -27,12 +27,16 @@ var ErrInitStart = errors.New("init from")
// Allows for us to notice when the connection is closed.
type conn struct {
net.Conn
wg *sync.WaitGroup
wg *sync.WaitGroup
isclose bool
}
func (c conn) Close() error {
err := c.Conn.Close()
c.wg.Done()
if !c.isclose {
c.wg.Done()
c.isclose = true
}
return err
}