add SendWaitObj Fn

This commit is contained in:
2022-01-07 15:07:24 +08:00
parent 555bc3653e
commit 3964cd05b0
4 changed files with 22 additions and 5 deletions
+9 -1
View File
@@ -273,7 +273,7 @@ func (c *ClientCommon) loadMessage() {
return
}
message := Message{
ServerConn: c,
ServerConn: c,
TransferMsg: msg.(TransferMsg),
NetType: NET_CLIENT,
}
@@ -469,6 +469,14 @@ func (c *ClientCommon) SendWait(key string, value MsgVal, timeout time.Duration)
}, timeout)
}
func (c *ClientCommon) SendWaitObj(key string, value interface{}, timeout time.Duration) (Message, error) {
data, err := c.sequenceEn(value)
if err != nil {
return Message{}, err
}
return c.SendWait(key, data, timeout)
}
func (c *ClientCommon) Reply(m Message, value MsgVal) error {
return m.Reply(value)
}