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
a3aa7838
Commit
a3aa7838
authored
Sep 30, 2016
by
alexstocks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify write timeout and wheel time interval
parent
61d671ba
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
dev.list
dev.list
+7
-0
session.go
session.go
+6
-2
version.go
version.go
+2
-2
No files found.
dev.list
View file @
a3aa7838
...
@@ -11,6 +11,13 @@
...
@@ -11,6 +11,13 @@
## develop history ##
## develop history ##
---
---
- 2016/09/30
> 1 modify wheel time interval from 1 second to 100ms.
>
> 2 modify session.go:(Session)WritePkg timeout
>
> 2 version: 0.3.13
- 2016/09/27
- 2016/09/27
> 1 fix bug: getty panic when conn.RemoteAddr() is nil in session.go:(Session)sessionToken()
> 1 fix bug: getty panic when conn.RemoteAddr() is nil in session.go:(Session)sessionToken()
>
>
...
...
session.go
View file @
a3aa7838
...
@@ -44,7 +44,7 @@ var (
...
@@ -44,7 +44,7 @@ var (
var
(
var
(
connID
uint32
connID
uint32
wheel
*
gxtime
.
Wheel
=
gxtime
.
NewWheel
(
gxtime
.
TimeSecondDuration
(
1
),
3600
)
// wheel longest span is 1 hour
wheel
=
gxtime
.
NewWheel
(
gxtime
.
TimeMillisecondDuration
(
100
),
6000
)
// wheel longest span is 10minute
)
)
type
gettyConn
struct
{
type
gettyConn
struct
{
...
@@ -326,6 +326,10 @@ func (this *Session) WritePkg(pkg interface{}) error {
...
@@ -326,6 +326,10 @@ func (this *Session) WritePkg(pkg interface{}) error {
}
}
}()
}()
var
d
=
this
.
wDeadline
if
d
>
netIOTimeout
{
d
=
netIOTimeout
}
select
{
select
{
case
this
.
wQ
<-
pkg
:
case
this
.
wQ
<-
pkg
:
break
// for possible gen a new pkg
break
// for possible gen a new pkg
...
@@ -333,7 +337,7 @@ func (this *Session) WritePkg(pkg interface{}) error {
...
@@ -333,7 +337,7 @@ func (this *Session) WritePkg(pkg interface{}) error {
// default:
// default:
// case <-time.After(this.wDeadline):
// case <-time.After(this.wDeadline):
// case <-time.After(netIOTimeout):
// case <-time.After(netIOTimeout):
case
<-
wheel
.
After
(
this
.
wDeadline
)
:
case
<-
wheel
.
After
(
d
)
:
log
.
Warn
(
"%s, [session.WritePkg] wQ{len:%d, cap:%d}"
,
this
.
Stat
(),
len
(
this
.
wQ
),
cap
(
this
.
wQ
))
log
.
Warn
(
"%s, [session.WritePkg] wQ{len:%d, cap:%d}"
,
this
.
Stat
(),
len
(
this
.
wQ
),
cap
(
this
.
wQ
))
return
ErrSessionBlocked
return
ErrSessionBlocked
}
}
...
...
version.go
View file @
a3aa7838
...
@@ -10,8 +10,8 @@
...
@@ -10,8 +10,8 @@
package
getty
package
getty
const
(
const
(
Version
=
"0.3.1
2
"
Version
=
"0.3.1
3
"
GETTY_MAJOR
=
0
GETTY_MAJOR
=
0
GETTY_MINOR
=
3
GETTY_MINOR
=
3
GETTY_BUILD
=
1
2
GETTY_BUILD
=
1
3
)
)
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