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
f066226b
Commit
f066226b
authored
Sep 19, 2016
by
alexstocks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add empty
parent
fce00ab9
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
11 deletions
+17
-11
client.go
client.go
+2
-4
dev.md
dev.md
+5
-0
server.go
server.go
+2
-2
session.go
session.go
+7
-4
version.go
version.go
+1
-1
No files found.
client.go
View file @
f066226b
...
...
@@ -25,8 +25,6 @@ const (
maxTimes
=
10
)
type
empty
struct
{}
type
Client
struct
{
// net
sync
.
Mutex
...
...
@@ -37,7 +35,7 @@ type Client struct {
sessionMap
map
[
*
Session
]
empty
sync
.
Once
done
chan
struct
{}
done
chan
empty
wg
sync
.
WaitGroup
}
...
...
@@ -58,7 +56,7 @@ func NewClient(connNum int, connInterval time.Duration, serverAddr string) *Clie
interval
:
connInterval
,
addr
:
serverAddr
,
sessionMap
:
make
(
map
[
*
Session
]
empty
,
connNum
),
done
:
make
(
chan
struct
{}
),
done
:
make
(
chan
empty
),
}
}
...
...
dev.md
View file @
f066226b
...
...
@@ -11,6 +11,11 @@
## develop history ##
---
-
2016/09/19
> 1 move empty to empty from client.go to session.go
>
> 2 version: 0.3.09
-
2016/09/12
> 1 add defeat self connection logic in client.go & server.go
>
...
...
server.go
View file @
f066226b
...
...
@@ -30,12 +30,12 @@ type Server struct {
listener
net
.
Listener
sync
.
Once
done
chan
struct
{}
done
chan
empty
wg
sync
.
WaitGroup
}
func
NewServer
()
*
Server
{
return
&
Server
{
done
:
make
(
chan
struct
{}
)}
return
&
Server
{
done
:
make
(
chan
empty
)}
}
func
(
this
*
Server
)
stop
()
{
...
...
session.go
View file @
f066226b
...
...
@@ -20,8 +20,9 @@ import (
)
import
(
log
"github.com/AlexStocks/log4go"
"runtime"
log
"github.com/AlexStocks/log4go"
)
const
(
...
...
@@ -105,6 +106,8 @@ var (
ErrSessionBlocked
=
errors
.
New
(
"Session full blocked"
)
)
type
empty
struct
{}
// getty base session
type
Session
struct
{
name
string
...
...
@@ -113,7 +116,7 @@ type Session struct {
pkgHandler
ReadWriter
listener
EventListener
once
sync
.
Once
done
chan
struct
{}
done
chan
empty
// readerDone chan struct{} // end reader
peroid
time
.
Duration
...
...
@@ -134,7 +137,7 @@ func NewSession(conn net.Conn) *Session {
return
&
Session
{
name
:
defaultSessionName
,
gettyConn
:
newGettyConn
(
conn
),
done
:
make
(
chan
struct
{}
),
done
:
make
(
chan
empty
),
// readerDone: make(chan struct{}),
peroid
:
peroid
,
rDeadline
:
netIOTimeout
,
...
...
@@ -146,7 +149,7 @@ func NewSession(conn net.Conn) *Session {
func
(
this
*
Session
)
Reset
()
{
this
.
name
=
defaultSessionName
this
.
done
=
make
(
chan
struct
{}
)
this
.
done
=
make
(
chan
empty
)
// this.readerDone = make(chan struct{})
this
.
peroid
=
peroid
this
.
rDeadline
=
netIOTimeout
...
...
version.go
View file @
f066226b
...
...
@@ -10,5 +10,5 @@
package
getty
var
(
Version
=
"0.3.0
8
"
Version
=
"0.3.0
9
"
)
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