Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
f2925978
Commit
f2925978
authored
Jun 16, 2017
by
astaxie
Committed by
GitHub
Jun 16, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2717 from huwenbo/master
fix panic sync: negative WaitGroup counter
parents
fe3a224a
2b00b7d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
conn.go
grace/conn.go
+12
-1
listener.go
grace/listener.go
+1
-1
No files found.
grace/conn.go
View file @
f2925978
...
...
@@ -3,14 +3,17 @@ package grace
import
(
"errors"
"net"
"sync"
)
type
graceConn
struct
{
net
.
Conn
server
*
Server
m
sync
.
Mutex
closed
bool
}
func
(
c
graceConn
)
Close
()
(
err
error
)
{
func
(
c
*
graceConn
)
Close
()
(
err
error
)
{
defer
func
()
{
if
r
:=
recover
();
r
!=
nil
{
switch
x
:=
r
.
(
type
)
{
...
...
@@ -23,6 +26,14 @@ func (c graceConn) Close() (err error) {
}
}
}()
c
.
m
.
Lock
()
if
c
.
closed
{
c
.
m
.
Unlock
()
return
}
c
.
server
.
wg
.
Done
()
c
.
closed
=
true
c
.
m
.
Unlock
()
return
c
.
Conn
.
Close
()
}
grace/listener.go
View file @
f2925978
...
...
@@ -37,7 +37,7 @@ func (gl *graceListener) Accept() (c net.Conn, err error) {
tc
.
SetKeepAlive
(
true
)
tc
.
SetKeepAlivePeriod
(
3
*
time
.
Minute
)
c
=
graceConn
{
c
=
&
graceConn
{
Conn
:
tc
,
server
:
gl
.
server
,
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment