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
58244ae5
Unverified
Commit
58244ae5
authored
Jul 19, 2020
by
Xin.Zh
Committed by
GitHub
Jul 19, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #43 from zaihang365/feature/removeCodes
Feature/removeSomeCommits
parents
1d95e7c7
80031a30
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
4 deletions
+6
-4
client.go
demo/hello/tcp/client/client.go
+1
-0
config.go
demo/hello/tcp/config.go
+2
-1
getty.go
getty.go
+1
-1
session.go
session.go
+2
-2
No files found.
demo/hello/tcp/client/client.go
View file @
58244ae5
...
...
@@ -75,6 +75,7 @@ func main() {
taskPool
.
Close
()
}
// NewHelloClientSession use for init client session
func
NewHelloClientSession
(
session
getty
.
Session
)
(
err
error
)
{
tcp
.
EventListener
.
SessionOnOpen
=
func
(
session
getty
.
Session
)
{
hello
.
Sessions
=
append
(
hello
.
Sessions
,
session
)
...
...
demo/hello/tcp/config.go
View file @
58244ae5
...
...
@@ -32,7 +32,8 @@ import (
)
var
(
pkgHandler
=
&
hello
.
PackageHandler
{}
pkgHandler
=
&
hello
.
PackageHandler
{}
// EventListener register event callback
EventListener
=
&
hello
.
MessageHandler
{}
)
...
...
getty.go
View file @
58244ae5
...
...
@@ -57,7 +57,7 @@ type Writer interface {
Write
(
Session
,
interface
{})
([]
byte
,
error
)
}
//
package handler interface
//
ReadWriter interface use for handle application packages
type
ReadWriter
interface
{
Reader
Writer
...
...
session.go
View file @
58244ae5
...
...
@@ -46,7 +46,7 @@ const (
pendingDuration
=
3e9
defaultQLen
=
1024
maxIovecNum
=
10
M
axWheelTimeSpan
=
900e9
// 900s, 15 minute
m
axWheelTimeSpan
=
900e9
// 900s, 15 minute
defaultSessionName
=
"session"
defaultTCPSessionName
=
"tcp-session"
...
...
@@ -66,7 +66,7 @@ var (
func
init
()
{
span
:=
100e6
// 100ms
buckets
:=
M
axWheelTimeSpan
/
span
buckets
:=
m
axWheelTimeSpan
/
span
wheel
=
gxtime
.
NewWheel
(
time
.
Duration
(
span
),
int
(
buckets
))
// wheel longest span is 15 minute
}
...
...
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