Commit 63d599ba authored by alexstocks's avatar alexstocks

add (Client)SessionArray

parent 1ca66977
...@@ -13,9 +13,11 @@ ...@@ -13,9 +13,11 @@
- 2016/09/02 - 2016/09/02
> 1 add session.go:(gettyConn)close and session.go:(Session)dispose > 1 add session.go:(gettyConn)close and session.go:(Session)dispose
> >
> 2 add client.go:Client > 2 modify return value of server.go:SessionCallback from void to err
>
> 3 add client.go:Client
> >
> 3 version: 0.3.00 > 4 version: 0.3.00
- 2016/08/29 - 2016/08/29
> 1 rename reconnect to errFlag in function session.go:(Session)handlePackage > 1 rename reconnect to errFlag in function session.go:(Session)handlePackage
......
...@@ -94,6 +94,21 @@ func (this *Client) getSessionNum() int { ...@@ -94,6 +94,21 @@ func (this *Client) getSessionNum() int {
return num return num
} }
func (this *Client) GetSessionArray() []*Session {
var array []*Session
this.Lock()
for s := range this.sessionMap {
if s.IsClosed() {
delete(this.sessionMap, s)
continue
}
array = append(array, s)
}
this.Unlock()
return array
}
func (this *Client) connect() { func (this *Client) connect() {
var ( var (
err error err error
......
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