mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 19:10:54 +00:00
add mutex
This commit is contained in:
parent
573df2e747
commit
71adbdd7d7
@ -29,9 +29,12 @@ type conn struct {
|
|||||||
net.Conn
|
net.Conn
|
||||||
wg *sync.WaitGroup
|
wg *sync.WaitGroup
|
||||||
isclose bool
|
isclose bool
|
||||||
|
lock sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c conn) Close() error {
|
func (c conn) Close() error {
|
||||||
|
c.lock.Lock()
|
||||||
|
defer c.lock.Unlock()
|
||||||
err := c.Conn.Close()
|
err := c.Conn.Close()
|
||||||
if !c.isclose {
|
if !c.isclose {
|
||||||
c.wg.Done()
|
c.wg.Done()
|
||||||
|
Loading…
Reference in New Issue
Block a user