Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewei
wecloud_im_server
Commits
9a15f298
Commit
9a15f298
authored
Mar 18, 2022
by
Future
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消息丢失排查日志添加
parent
2e1395be
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletions
+9
-1
core/src/main/java/com/wecloud/im/ws/sender/ChannelSender.java
+9
-1
No files found.
core/src/main/java/com/wecloud/im/ws/sender/ChannelSender.java
View file @
9a15f298
...
@@ -128,15 +128,21 @@ public class ChannelSender {
...
@@ -128,15 +128,21 @@ public class ChannelSender {
String
msgJson
=
JsonUtils
.
encodeJson
(
responseModel
);
String
msgJson
=
JsonUtils
.
encodeJson
(
responseModel
);
List
<
ClientChannelInfo
>
channelInfos
=
userStateCacheManager
.
findOnlineInfosByClientId
(
toClientId
);
List
<
ClientChannelInfo
>
channelInfos
=
userStateCacheManager
.
findOnlineInfosByClientId
(
toClientId
);
log
.
info
(
"获取在线用户入参 {}, 结果 {}"
,
toClientId
,
JSON
.
toJSONString
(
channelInfos
));
// 一个用户存在多端的情况,所以先进行分类,key是ip地址,value是channel的列表
// 一个用户存在多端的情况,所以先进行分类,key是ip地址,value是channel的列表
Map
<
String
,
List
<
ClientChannelInfo
>>
ipChannels
=
channelInfos
.
stream
().
collect
(
Collectors
.
groupingBy
(
ClientChannelInfo:
:
getLanIp
));
Map
<
String
,
List
<
ClientChannelInfo
>>
ipChannels
=
channelInfos
.
stream
().
collect
(
Collectors
.
groupingBy
(
ClientChannelInfo:
:
getLanIp
));
log
.
info
(
"分组在线用户入参 {}, 结果 {}"
,
toClientId
,
JSON
.
toJSONString
(
ipChannels
));
for
(
Map
.
Entry
<
String
,
List
<
ClientChannelInfo
>>
channelInfoEntry
:
ipChannels
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
ClientChannelInfo
>>
channelInfoEntry
:
ipChannels
.
entrySet
())
{
log
.
info
(
"在线用户入参 {}, 具体ip结果 {}"
,
toClientId
,
JSON
.
toJSONString
(
channelInfoEntry
));
// 是否为当前机器的ip
// 是否为当前机器的ip
if
(
GetIpUtils
.
getlanIp
().
equals
(
channelInfoEntry
.
getKey
()))
{
if
(
GetIpUtils
.
getlanIp
().
equals
(
channelInfoEntry
.
getKey
()))
{
// 调用本地下发
// 调用本地下发
log
.
info
(
"在线用户入参 {}, 具体ip结果 {}"
,
toClientId
,
JSON
.
toJSONString
(
channelInfoEntry
));
for
(
ClientChannelInfo
clientChannelInfo
:
channelInfoEntry
.
getValue
())
{
for
(
ClientChannelInfo
clientChannelInfo
:
channelInfoEntry
.
getValue
())
{
this
.
sendMsgLocal
(
toClientId
,
clientChannelInfo
.
getPlatform
(),
msgJson
);
this
.
sendMsgLocal
(
toClientId
,
clientChannelInfo
.
getPlatform
(),
msgJson
);
}
}
...
@@ -217,8 +223,10 @@ public class ChannelSender {
...
@@ -217,8 +223,10 @@ public class ChannelSender {
* @return
* @return
*/
*/
private
boolean
sendMsgLocal
(
String
key
,
String
msgJsonStr
)
{
private
boolean
sendMsgLocal
(
String
key
,
String
msgJsonStr
)
{
log
.
info
(
"消息推送 key {} 内容 {}"
,
key
,
msgJsonStr
);
ClientInfo
clientInfo
=
ChannelManager
.
SESSION_INFO_MAP
.
get
(
key
);
ClientInfo
clientInfo
=
ChannelManager
.
SESSION_INFO_MAP
.
get
(
key
);
if
(
clientInfo
==
null
)
{
if
(
clientInfo
==
null
)
{
log
.
info
(
"消息推送 key {} 本地map取设备信息为空"
,
key
);
return
false
;
return
false
;
}
}
...
@@ -229,7 +237,7 @@ public class ChannelSender {
...
@@ -229,7 +237,7 @@ public class ChannelSender {
}
}
// 判断连接是否断开
// 判断连接是否断开
if
(
nioSocketChannel
.
isShutdown
())
{
if
(
nioSocketChannel
.
isShutdown
())
{
log
.
warn
(
"writeData 已连接断开: {}\n channelId: {}"
,
msgJsonStr
,
nioSocketChannel
.
id
().
asLongText
());
log
.
info
(
"writeData 已连接断开: {}\n channelId: {}"
,
msgJsonStr
,
nioSocketChannel
.
id
().
asLongText
());
return
false
;
return
false
;
}
}
...
...
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