新增对Rpc连接事件的监听

This commit is contained in:
boyce
2020-12-05 11:37:11 +08:00
parent dfba2fbe47
commit 9bad0037aa
5 changed files with 124 additions and 1 deletions

View File

@@ -26,6 +26,7 @@ type Client struct {
pendingTimer *list.List
callRpcTimeout time.Duration
maxCheckCallRpcCount int
TriggerRpcEvent
}
func (client *Client) NewClientAgent(conn *network.TCPConn) network.Agent {
@@ -259,6 +260,7 @@ func (client *Client) Run(){
}
}()
client.TriggerRpcEvent(true,client.GetId())
for {
bytes,err := client.conn.ReadMsg()
if err != nil {
@@ -314,6 +316,7 @@ func (client *Client) Run(){
}
func (client *Client) OnClose(){
client.TriggerRpcEvent(false,client.GetId())
}
func (client *Client) IsConnected() bool {