Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/com/corundumstudio/socketio/SocketIOServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class SocketIOServer implements ClientListeners {

private SocketIOChannelInitializer pipelineFactory = new SocketIOChannelInitializer();

private Channel channel;
private EventLoopGroup bossGroup;
private EventLoopGroup workerGroup;

Expand Down Expand Up @@ -151,6 +152,7 @@ public Future<Void> startAsync() {
@Override
public void operationComplete(Future<Void> future) throws Exception {
if (future.isSuccess()) {
channel = ((ChannelFuture)future).channel();
log.info("SocketIO server started at port: {}", configCopy.getPort());
} else {
log.error("SocketIO server start failed at port: {}!", configCopy.getPort());
Expand Down Expand Up @@ -190,6 +192,9 @@ protected void initGroups() {
* Stop server
*/
public void stop() {
if(channel != null) {
channel.close().syncUninterruptibly();
}
bossGroup.shutdownGracefully().syncUninterruptibly();
workerGroup.shutdownGracefully().syncUninterruptibly();

Expand Down