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
3d2582d2
Commit
3d2582d2
authored
Sep 22, 2021
by
giaogiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加close ChannelFuture
parent
888fcd4d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
common/src/main/java/com/wecloud/im/netty/core/WsReadHandler.java
+10
-2
No files found.
common/src/main/java/com/wecloud/im/netty/core/WsReadHandler.java
View file @
3d2582d2
...
...
@@ -4,6 +4,8 @@ import cn.hutool.core.thread.ThreadFactoryBuilder;
import
com.wecloud.im.ws.model.WsConstants
;
import
com.wecloud.im.ws.receive.ReadWsData
;
import
com.wecloud.im.ws.service.MangerChannelService
;
import
io.netty.channel.ChannelFuture
;
import
io.netty.channel.ChannelFutureListener
;
import
io.netty.channel.ChannelHandler
;
import
io.netty.channel.ChannelHandlerContext
;
import
io.netty.channel.SimpleChannelInboundHandler
;
...
...
@@ -118,9 +120,15 @@ public class WsReadHandler extends SimpleChannelInboundHandler<TextWebSocketFram
@Override
public
void
handlerRemoved
(
ChannelHandlerContext
ctx
)
{
String
userIdByChannel
=
mangerChannelService
.
getInfoByChannel
(
ctx
);
log
.
info
(
"uid:"
+
userIdByChannel
+
","
+
"handlerRemoved"
+
",channelId:"
+
ctx
.
channel
().
id
().
asShortText
());
String
asLongText
=
ctx
.
channel
().
id
().
asLongText
();
log
.
info
(
"uid:"
+
userIdByChannel
+
","
+
"handlerRemoved-begin"
+
",channelId:"
+
asLongText
);
// 关掉连接
ctx
.
close
();
ChannelFuture
close
=
ctx
.
close
();
close
.
addListener
(
//执行后回调的方法
(
ChannelFutureListener
)
channelFuture1
->
{
log
.
info
(
"uid:"
+
userIdByChannel
+
","
+
"handlerRemoved-success"
+
",channelId:"
+
asLongText
);
});
}
}
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