[#1561] Fix Securechat example which was broken because Channel was not flushed
This commit is contained in:
parent
d23c3b3382
commit
1d577b1b8b
|
@ -47,10 +47,10 @@ public class SecureChatServerHandler extends SimpleChannelInboundHandler<String>
|
||||||
new GenericFutureListener<Future<Channel>>() {
|
new GenericFutureListener<Future<Channel>>() {
|
||||||
@Override
|
@Override
|
||||||
public void operationComplete(Future<Channel> future) throws Exception {
|
public void operationComplete(Future<Channel> future) throws Exception {
|
||||||
ctx.write(
|
ctx.writeAndFlush(
|
||||||
"Welcome to " + InetAddress.getLocalHost().getHostName() +
|
"Welcome to " + InetAddress.getLocalHost().getHostName() +
|
||||||
" secure chat service!\n");
|
" secure chat service!\n");
|
||||||
ctx.write(
|
ctx.writeAndFlush(
|
||||||
"Your session is protected by " +
|
"Your session is protected by " +
|
||||||
ctx.pipeline().get(SslHandler.class).engine().getSession().getCipherSuite() +
|
ctx.pipeline().get(SslHandler.class).engine().getSession().getCipherSuite() +
|
||||||
" cipher suite.\n");
|
" cipher suite.\n");
|
||||||
|
@ -65,10 +65,10 @@ public class SecureChatServerHandler extends SimpleChannelInboundHandler<String>
|
||||||
// Send the received message to all channels but the current one.
|
// Send the received message to all channels but the current one.
|
||||||
for (Channel c: channels) {
|
for (Channel c: channels) {
|
||||||
if (c != ctx.channel()) {
|
if (c != ctx.channel()) {
|
||||||
c.write("[" + ctx.channel().remoteAddress() + "] " +
|
c.writeAndFlush("[" + ctx.channel().remoteAddress() + "] " +
|
||||||
msg + '\n');
|
msg + '\n');
|
||||||
} else {
|
} else {
|
||||||
c.write("[you] " + msg + '\n');
|
c.writeAndFlush("[you] " + msg + '\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user