feat sn 改成 int64
This commit is contained in:
@@ -2,10 +2,10 @@ package grpc_client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"git.hlsq.asia/mmorpg/service-common/log"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"strconv"
|
||||
"sync"
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ type gatewayStream struct {
|
||||
stream grpc.ClientStream
|
||||
}
|
||||
|
||||
func findGatewayBySID(sid string, fun GatewayFun) (*gatewayStream, error) {
|
||||
func findGatewayBySID(sid int64, fun GatewayFun) (*gatewayStream, error) {
|
||||
key := gatewayKey(sid, fun)
|
||||
|
||||
if v, ok := gatewayServer.Load(key); ok {
|
||||
@@ -53,7 +53,7 @@ func findGatewayBySID(sid string, fun GatewayFun) (*gatewayStream, error) {
|
||||
return ss, nil
|
||||
}
|
||||
|
||||
func SendMessageToGateway(sid string, fun GatewayFun, msg proto.Message, re ...bool) error {
|
||||
func SendMessageToGateway(sid int64, fun GatewayFun, msg proto.Message, re ...bool) error {
|
||||
ss, err := findGatewayBySID(sid, fun)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -78,6 +78,6 @@ func SendMessageToGateway(sid string, fun GatewayFun, msg proto.Message, re ...b
|
||||
return nil
|
||||
}
|
||||
|
||||
func gatewayKey(sid string, fun GatewayFun) string {
|
||||
return sid + "-" + strconv.Itoa(int(fun))
|
||||
func gatewayKey(sid int64, fun GatewayFun) string {
|
||||
return fmt.Sprintf("%v-%v", sid, fun)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user