1
0
mirror of https://github.com/astaxie/beego.git synced 2024-07-01 03:14:14 +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

@ -28,11 +28,15 @@ var ErrInitStart = errors.New("init from")
type conn struct { type conn struct {
net.Conn net.Conn
wg *sync.WaitGroup wg *sync.WaitGroup
isclose bool
} }
func (c conn) Close() error { func (c conn) Close() error {
err := c.Conn.Close() err := c.Conn.Close()
if !c.isclose {
c.wg.Done() c.wg.Done()
c.isclose = true
}
return err return err
} }