Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-userCenter
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujiebin
hilo-userCenter
Commits
78f77d43
Commit
78f77d43
authored
Aug 18, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:去掉无用日志
parent
ff87a090
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
main.go
main.go
+8
-6
No files found.
main.go
View file @
78f77d43
...
@@ -130,7 +130,7 @@ func (s *server) Login(ctx context.Context, in *userCenter.LoginMessage) (*userC
...
@@ -130,7 +130,7 @@ func (s *server) Login(ctx context.Context, in *userCenter.LoginMessage) (*userC
}
}
func
(
s
*
server
)
Logout
(
ctx
context
.
Context
,
in
*
userCenter
.
LogoutMessage
)
(
*
userCenter
.
LogoutMessageRsp
,
error
)
{
func
(
s
*
server
)
Logout
(
ctx
context
.
Context
,
in
*
userCenter
.
LogoutMessage
)
(
*
userCenter
.
LogoutMessageRsp
,
error
)
{
mylogrus
.
MyLog
.
Infof
(
"Received logoutMsg: %s, %d
\n
"
,
in
.
GetClientAddr
(),
in
.
GetUid
())
//
mylogrus.MyLog.Infof("Received logoutMsg: %s, %d\n", in.GetClientAddr(), in.GetUid())
addr
:=
termManager
.
GetTerminal
(
in
.
Uid
)
addr
:=
termManager
.
GetTerminal
(
in
.
Uid
)
if
addr
!=
nil
&&
*
addr
==
in
.
ClientAddr
{
if
addr
!=
nil
&&
*
addr
==
in
.
ClientAddr
{
...
@@ -156,7 +156,7 @@ func (s *server) Logout(ctx context.Context, in *userCenter.LogoutMessage) (*use
...
@@ -156,7 +156,7 @@ func (s *server) Logout(ctx context.Context, in *userCenter.LogoutMessage) (*use
}
}
func
(
s
*
server
)
Multicast
(
ctx
context
.
Context
,
in
*
userCenter
.
MulticastMessage
)
(
*
userCenter
.
MulticastMessageRsp
,
error
)
{
func
(
s
*
server
)
Multicast
(
ctx
context
.
Context
,
in
*
userCenter
.
MulticastMessage
)
(
*
userCenter
.
MulticastMessageRsp
,
error
)
{
mylogrus
.
MyLog
.
Infof
(
"Multicasting msgType = %d to %v, size = %d
\n
"
,
in
.
MsgType
,
in
.
Uids
,
len
(
in
.
PayLoad
))
//
mylogrus.MyLog.Infof("Multicasting msgType = %d to %v, size = %d\n", in.MsgType, in.Uids, len(in.PayLoad))
failed
:=
[]
uint64
{}
failed
:=
[]
uint64
{}
for
_
,
uid
:=
range
in
.
Uids
{
for
_
,
uid
:=
range
in
.
Uids
{
...
@@ -187,7 +187,7 @@ func (s *server) Multicast(ctx context.Context, in *userCenter.MulticastMessage)
...
@@ -187,7 +187,7 @@ func (s *server) Multicast(ctx context.Context, in *userCenter.MulticastMessage)
}
}
func
(
s
*
server
)
Broadcast
(
ctx
context
.
Context
,
in
*
userCenter
.
BroadcastMessage
)
(
*
userCenter
.
BroadcastMessageRsp
,
error
)
{
func
(
s
*
server
)
Broadcast
(
ctx
context
.
Context
,
in
*
userCenter
.
BroadcastMessage
)
(
*
userCenter
.
BroadcastMessageRsp
,
error
)
{
mylogrus
.
MyLog
.
Infof
(
"Broadcasting msgType = %d, size = %d
\n
"
,
in
.
MsgType
,
len
(
in
.
PayLoad
))
//
mylogrus.MyLog.Infof("Broadcasting msgType = %d, size = %d\n", in.MsgType, len(in.PayLoad))
failed
:=
[]
uint64
{}
failed
:=
[]
uint64
{}
terminals
:=
termManager
.
GetAll
()
terminals
:=
termManager
.
GetAll
()
...
@@ -306,7 +306,9 @@ func realBroadcast(addr string, uids []uint64, msg *userCenter.BroadcastMessage)
...
@@ -306,7 +306,9 @@ func realBroadcast(addr string, uids []uint64, msg *userCenter.BroadcastMessage)
toRouterClient
:=
userCenter
.
NewRouterClient
(
client
)
toRouterClient
:=
userCenter
.
NewRouterClient
(
client
)
status
,
err
:=
routeMessage
(
toRouterClient
,
uid
,
msg
.
MsgType
,
msg
.
PayLoad
)
status
,
err
:=
routeMessage
(
toRouterClient
,
uid
,
msg
.
MsgType
,
msg
.
PayLoad
)
mylogrus
.
MyLog
.
Infof
(
"routeMessage uid = %d, msgType = %d, status = %d, %v"
,
uid
,
msg
.
MsgType
,
status
,
err
)
if
err
!=
nil
{
mylogrus
.
MyLog
.
Errorf
(
"routeMessage uid = %d, msgType = %d, status = %d, %v"
,
uid
,
msg
.
MsgType
,
status
,
err
)
}
}
}
}
}
}
}
...
@@ -322,7 +324,7 @@ func routeMessage(c userCenter.RouterClient, uid uint64, msgType uint32, data []
...
@@ -322,7 +324,7 @@ func routeMessage(c userCenter.RouterClient, uid uint64, msgType uint32, data []
if
err
!=
nil
{
if
err
!=
nil
{
mylogrus
.
MyLog
.
Errorf
(
"Route message to user %d, err: %s
\n
"
,
uid
,
err
.
Error
())
mylogrus
.
MyLog
.
Errorf
(
"Route message to user %d, err: %s
\n
"
,
uid
,
err
.
Error
())
}
else
if
r
!=
nil
{
}
else
if
r
!=
nil
{
mylogrus
.
MyLog
.
Infof
(
"Route message to user %d, status = %d"
,
uid
,
r
.
Status
)
//
mylogrus.MyLog.Infof("Route message to user %d, status = %d", uid, r.Status)
return
r
.
Status
,
err
return
r
.
Status
,
err
}
}
return
0
,
err
return
0
,
err
...
@@ -616,7 +618,7 @@ func kick(n int) {
...
@@ -616,7 +618,7 @@ func kick(n int) {
func
broadcast
(
n
int
)
{
func
broadcast
(
n
int
)
{
for
msg
:=
range
broadcastChan
{
for
msg
:=
range
broadcastChan
{
mylogrus
.
MyLog
.
Infof
(
"handling broadcast in:%d,msg:%+v"
,
n
,
msg
)
//
mylogrus.MyLog.Infof("handling broadcast in:%d,msg:%+v", n, msg)
realBroadcast
(
msg
.
ProxyAddr
,
msg
.
UserIds
,
msg
.
in
)
// fixme: 这里还有优化空间,广播能否在proxy层做批量
realBroadcast
(
msg
.
ProxyAddr
,
msg
.
UserIds
,
msg
.
in
)
// fixme: 这里还有优化空间,广播能否在proxy层做批量
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment