feat 排队
This commit is contained in:
@@ -4,7 +4,8 @@ import (
|
||||
"common/log"
|
||||
"common/proto/sc/sc_pb"
|
||||
"common/proto/ss/grpc_pb"
|
||||
"gateway/internal/handler/ws_handler"
|
||||
"context"
|
||||
"gateway/internal/handler/ws_handler/client"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"sync"
|
||||
)
|
||||
@@ -38,16 +39,16 @@ func (s *Server) ToClient(server grpc_pb.Gateway_ToClientServer) error {
|
||||
log.Errorf("ToClient proto.Marshal error: %v", err)
|
||||
continue
|
||||
}
|
||||
for _, client := range ws_handler.UserMgr.GetAll() {
|
||||
client.WriteBytesPreMarshal(data)
|
||||
for _, cli := range client.UserMgr.GetAll() {
|
||||
cli.WriteBytesPreMarshal(data)
|
||||
}
|
||||
|
||||
//for _, client := range ws_handler.UserMgr.GetAll() {
|
||||
// client.WriteBytes(sc_pb.MessageID(args.MessageID), args.Payload)
|
||||
//}
|
||||
} else {
|
||||
if client := ws_handler.UserMgr.GetByUSN(args.USN); client != nil {
|
||||
client.WriteBytes(sc_pb.MessageID(args.MessageID), args.Payload)
|
||||
if cli := client.UserMgr.GetByUSN(args.USN); cli != nil {
|
||||
cli.WriteBytes(sc_pb.MessageID(args.MessageID), args.Payload)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,3 +57,7 @@ func (s *Server) ToClient(server grpc_pb.Gateway_ToClientServer) error {
|
||||
wg.Wait()
|
||||
return server.SendAndClose(&grpc_pb.ToClientResp{})
|
||||
}
|
||||
|
||||
func (s *Server) KickUser(ctx context.Context, req *grpc_pb.KickUserReq) (*grpc_pb.KickUserResp, error) {
|
||||
return &grpc_pb.KickUserResp{}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user