Commit f066226b authored by alexstocks's avatar alexstocks

add empty

parent fce00ab9
......@@ -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),
}
}
......
......@@ -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
>
......
......@@ -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() {
......
......@@ -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
......
......@@ -10,5 +10,5 @@
package getty
var (
Version = "0.3.08"
Version = "0.3.09"
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment