You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
635 B
37 lines
635 B
package task |
|
|
|
import ( |
|
"server/pb" |
|
|
|
"github.com/gogo/protobuf/proto" |
|
"github.com/liangdas/mqant/log" |
|
) |
|
|
|
func U(msg []byte, resp proto.Message) bool { |
|
if err := proto.Unmarshal(msg, resp); err != nil { |
|
log.Error("%T err:%v", resp, err) |
|
return false |
|
} |
|
return true |
|
} |
|
|
|
func (w *WsWork) LoginResp(msg []byte) { |
|
resp := new(pb.LoginResponse) |
|
if !U(msg, resp) { |
|
return |
|
} |
|
log.Debug("LoginResp resp:%+v", resp) |
|
// return |
|
if resp.Result != 0 { |
|
return |
|
} |
|
// w.Wait() |
|
} |
|
|
|
func (w *WsWork) BroadcastResp(msg []byte) { |
|
resp := new(pb.BroadcastMsg) |
|
if !U(msg, resp) { |
|
return |
|
} |
|
// log.Debug("BroadcastResp resp:%+v", resp) |
|
}
|
|
|