Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
getty
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wei.xuan
getty
Commits
d96fdbea
Commit
d96fdbea
authored
Aug 23, 2016
by
alexstocks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug: infinite loop in (Session)handlePkg
parent
0d628f14
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
session.go
session.go
+5
-4
No files found.
session.go
View file @
d96fdbea
...
...
@@ -433,11 +433,11 @@ func (this *Session) handlePackage() {
this
.
conn
.
SetReadDeadline
(
time
.
Now
()
.
Add
(
this
.
readDeadline
))
len
,
err
=
this
.
read
(
buf
)
if
err
!=
nil
{
log
.
Warn
(
"%s:%d:%s [session.conn.read] = error{%s}"
,
this
.
name
,
this
.
Id
,
this
.
conn
.
RemoteAddr
()
.
String
(),
err
.
Error
())
if
nerr
,
ok
=
err
.
(
net
.
Error
);
ok
&&
nerr
.
Timeout
()
{
break
}
log
.
Error
(
"%s:%d:%s [session.conn.read] = error{%s}"
,
this
.
name
,
this
.
Id
,
this
.
conn
.
RemoteAddr
()
.
String
(),
err
.
Error
())
// 遇到网络错误的时候,handlePackage能够及时退出,但是handleLoop的第一个for-select因为要处理(Codec)OnMessage
// 导致程序不能及时退出,此处添加(Codec)OnError调用以及时通知getty调用者
// AS, 2016/08/21
...
...
@@ -462,9 +462,10 @@ func (this *Session) handlePackage() {
exit
=
true
break
}
if
pkg
!
=
nil
{
this
.
reqQ
<-
pkg
if
pkg
=
=
nil
{
break
}
this
.
reqQ
<-
pkg
}
if
exit
{
break
...
...
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