MCPcopy Create free account
hub / github.com/LockGit/gochat / InitLogicRpcClient

Function InitLogicRpcClient

api/rpc/rpc.go:29–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27var RpcLogicObj *RpcLogic
28
29func InitLogicRpcClient() {
30 once.Do(func() {
31 etcdConfigOption := &store.Config{
32 ClientTLS: nil,
33 TLS: nil,
34 ConnectionTimeout: time.Duration(config.Conf.Common.CommonEtcd.ConnectionTimeout) * time.Second,
35 Bucket: "",
36 PersistConnection: true,
37 Username: config.Conf.Common.CommonEtcd.UserName,
38 Password: config.Conf.Common.CommonEtcd.Password,
39 }
40 d, err := etcdV3.NewEtcdV3Discovery(
41 config.Conf.Common.CommonEtcd.BasePath,
42 config.Conf.Common.CommonEtcd.ServerPathLogic,
43 []string{config.Conf.Common.CommonEtcd.Host},
44 true,
45 etcdConfigOption,
46 )
47 if err != nil {
48 logrus.Fatalf("init connect rpc etcd discovery client fail:%s", err.Error())
49 }
50 LogicRpcClient = client.NewXClient(config.Conf.Common.CommonEtcd.ServerPathLogic, client.Failtry, client.RandomSelect, d, client.DefaultOption)
51 RpcLogicObj = new(RpcLogic)
52 })
53 if LogicRpcClient == nil {
54 logrus.Fatalf("get logic rpc client nil")
55 }
56}
57
58func (rpc *RpcLogic) Login(req *proto.LoginRequest) (code int, authToken string, msg string) {
59 reply := &proto.LoginResponse{}

Callers 2

RunMethod · 0.92
initFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected