mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 21:01:31 +00:00
add isclose call close many times
This commit is contained in:
parent
aa9cb6d052
commit
573df2e747
@ -27,12 +27,16 @@ var ErrInitStart = errors.New("init from")
|
|||||||
// Allows for us to notice when the connection is closed.
|
// Allows for us to notice when the connection is closed.
|
||||||
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()
|
||||||
c.wg.Done()
|
if !c.isclose {
|
||||||
|
c.wg.Done()
|
||||||
|
c.isclose = true
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user