@Override public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { if (LOG.isTraceEnabled()) { LOG.trace("Channel connected " + e); } NettyServerCnxn cnxn = new NettyServerCnxn(ctx.getChannel(), zkServer, NettyServerCnxnFactory.this); ctx.setAttachment(cnxn); if (secure) { SslHandler sslHandler = ctx.getPipeline().get(SslHandler.class); ChannelFuture handshakeFuture = sslHandler.handshake(); handshakeFuture.addListener(new CertificateVerifier(sslHandler, cnxn)); } else { allChannels.add(ctx.getChannel()); addCnxn(cnxn); } }
@Override public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent evt) { log.debug("OspfChannelHandler::channelDisconnected...!!!"); for (Integer interfaceIndex : ospfInterfaceMap.keySet()) { OspfInterface anInterface = ospfInterfaceMap.get(interfaceIndex); if (anInterface != null) { anInterface.interfaceDown(); anInterface.stopDelayedAckTimer(); } } if (controller != null) { controller.connectPeer(); } }
@Override public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { log.info("Pcc disconnected callback for pc:{}. Cleaning up ...", getClientInfoString()); if (thispccId != null) { if (!duplicatePccIdFound) { // if the disconnected client (on this ChannelHandler) // was not one with a duplicate-dpid, it is safe to remove all // state for it at the controller. Notice that if the disconnected // client was a duplicate-ip, calling the method below would clear // all state for the original client (with the same ip), // which we obviously don't want. log.debug("{}:removal called", getClientInfoString()); if (pc != null) { pc.removeConnectedClient(); } } else { // A duplicate was disconnected on this ChannelHandler, // this is the same client reconnecting, but the original state was // not cleaned up - XXX check liveness of original ChannelHandler log.debug("{}:duplicate found", getClientInfoString()); duplicatePccIdFound = Boolean.FALSE; } } else { log.warn("no pccip in channelHandler registered for " + "disconnected client {}", getClientInfoString()); } }
@Override @LogMessageDoc(message="Disconnected switch {switch information}", explanation="The specified switch has disconnected.") public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { controller.removeSwitchChannel(this); if (this.sw != null) { // TODO: switchDisconnected() will check if we've previously // activated the switch. Nevertheless, we might want to check // here as well. controller.switchDisconnected(this.sw); this.sw.setConnected(false); } log.info("Disconnected switch {}", getSwitchInfoString()); }
@Override public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { if (LOG.isTraceEnabled()) { LOG.trace("Channel connected " + e); } NettyServerCnxn cnxn = new NettyServerCnxn(ctx.getChannel(), zkServer, NettyServerCnxnFactory.this); ctx.setAttachment(cnxn); //SECUREKEEPER: Enable ssl only if specified //if (secure) { if(encryption.equals("ssl")){ SslHandler sslHandler = ctx.getPipeline().get(SslHandler.class); ChannelFuture handshakeFuture = sslHandler.handshake(); handshakeFuture.addListener(new CertificateVerifier(sslHandler, cnxn)); } else { allChannels.add(ctx.getChannel()); addCnxn(cnxn); } }
@Override public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { if (null != channelGroups) { channelGroups.add(e.getChannel()); } }
@Override public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { NettyChannel channel = NettyChannel.getOrAddChannel(ctx.getChannel(), url, handler); try { if (channel != null) { channels.put(NetUtils.toAddressString((InetSocketAddress) ctx.getChannel().getRemoteAddress()), channel); } handler.connected(channel); } finally { NettyChannel.removeChannelIfDisconnected(ctx.getChannel()); } }
@Override public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { NettyChannel channel = NettyChannel.getOrAddChannel(ctx.getChannel(), url, handler); try { channels.remove(NetUtils.toAddressString((InetSocketAddress) ctx.getChannel().getRemoteAddress())); handler.disconnected(channel); } finally { NettyChannel.removeChannelIfDisconnected(ctx.getChannel()); } }
@Override public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { if (LOG.isTraceEnabled()) { LOG.trace("Channel closed " + e); } allChannels.remove(ctx.getChannel()); }
@Override public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { if (LOG.isTraceEnabled()) { LOG.trace("Channel connected " + e); } allChannels.add(ctx.getChannel()); NettyServerCnxn cnxn = new NettyServerCnxn(ctx.getChannel(), zkServer, NettyServerCnxnFactory.this); ctx.setAttachment(cnxn); addCnxn(cnxn); }
@Override public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { if (LOG.isTraceEnabled()) { LOG.trace("Channel disconnected " + e); } NettyServerCnxn cnxn = (NettyServerCnxn) ctx.getAttachment(); if (cnxn != null) { if (LOG.isTraceEnabled()) { LOG.trace("Channel disconnect caused close " + e); } cnxn.close(); } }
@Override public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { MyToast.ShowMessage(SMsgManage.getManager().getCurrContext(), e.toString()); Log.i(ClientHandler.class.getName(), e.toString()); super.channelConnected(ctx, e); }
@Override public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) { Log.info(formatChannel(e.getChannel()) + " disconnected"); closeChannel(e.getChannel()); BaseProtocolDecoder protocolDecoder = (BaseProtocolDecoder) ctx.getPipeline().get("objectDecoder"); if (ctx.getPipeline().get("httpDecoder") == null && !connectionlessProtocols.contains(protocolDecoder.getProtocolName())) { Context.getConnectionManager().removeActiveDevice(e.getChannel()); } }
@Override public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent evt) throws Exception { if ((maxShuffleConnections > 0) && (accepted.size() >= maxShuffleConnections)) { LOG.info(String.format("Current number of shuffle connections (%d) is " + "greater than or equal to the max allowed shuffle connections (%d)", accepted.size(), maxShuffleConnections)); evt.getChannel().close(); return; } accepted.add(evt.getChannel()); super.channelOpen(ctx, evt); }
@Override public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) { // Send the request if (LOG.isDebugEnabled()) { LOG.debug("sending PRC request"); } ChannelBuffer outBuf = XDR.writeMessageTcp(request, true); e.getChannel().write(outBuf); }
/** * Tests channelConnected() method. */ @Test(expected = Exception.class) public void testChannelConnected() throws Exception { channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class); channelStateEvent = EasyMock.createMock(ChannelStateEvent.class); ospfInterfaceChannelHandler.channelConnected(channelHandlerContext, channelStateEvent); }
/** * Tests channelDisconnected() method. */ @Test public void testChannelDisconnected() throws Exception { channelHandlerContext = EasyMock.createMock(ChannelHandlerContext.class); channelStateEvent = EasyMock.createMock(ChannelStateEvent.class); ospfInterfaceChannelHandler.channelDisconnected(channelHandlerContext, channelStateEvent); assertThat(ospfInterfaceChannelHandler, is(notNullValue())); }
@Override public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { if (timeoutNanos > 0) { timeout = timer.newTimeout(new HandshakeTimeoutTask(ctx), timeoutNanos, TimeUnit.NANOSECONDS); } ctx.sendUpstream(e); }
@Override public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { if (timeout != null) { timeout.cancel(); timeout = null; } }
@Override public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { channel = e.getChannel(); log.info("New switch connection from {}", channel.getRemoteAddress()); /* hack to wait for the switch to tell us what it's max version is. This is not spec compliant and should be removed as soon as switches behave better. */ //sendHandshakeHelloMessage(); setState(ChannelState.WAIT_HELLO); }
@Override public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { log.info("Switch disconnected callback for sw:{}. Cleaning up ...", getSwitchInfoString()); if (thisdpid != 0) { if (!duplicateDpidFound) { // if the disconnected switch (on this ChannelHandler) // was not one with a duplicate-dpid, it is safe to remove all // state for it at the controller. Notice that if the disconnected // switch was a duplicate-dpid, calling the method below would clear // all state for the original switch (with the same dpid), // which we obviously don't want. log.info("{}:removal called", getSwitchInfoString()); if (sw != null) { sw.removeConnectedSwitch(); } } else { // A duplicate was disconnected on this ChannelHandler, // this is the same switch reconnecting, but the original state was // not cleaned up - XXX check liveness of original ChannelHandler log.info("{}:duplicate found", getSwitchInfoString()); duplicateDpidFound = Boolean.FALSE; } } else { log.warn("no dpid in channelHandler registered for " + "disconnected switch {}", getSwitchInfoString()); } }
@Override public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { channel = e.getChannel(); log.info("PCC connected from {}", channel.getRemoteAddress()); // Wait for open message from pcc client setState(ChannelState.OPENWAIT); }
@Override public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent evt) { log.debug("IsisChannelHandler::channelDisconnected...!!!"); if (controller != null) { controller.connectPeer(); stopHelloSender(); } }
@Before public void setUp() throws Exception { controller = EasyMock.createNiceMock(Controller.class); isisProcess = EasyMock.createNiceMock(IsisProcess.class); channelHandlerContext = EasyMock.createNiceMock(ChannelHandlerContext.class); channelStateEvent = EasyMock.createNiceMock(ChannelStateEvent.class); exceptionEvent = EasyMock.createNiceMock(ExceptionEvent.class); messageEvent = EasyMock.createNiceMock(MessageEvent.class); isisMessage = EasyMock.createNiceMock(L1L2HelloPdu.class); isisMessage.setInterfaceIndex(2); isisChannelHandler = new IsisChannelHandler(controller, isisProcessList); }
@Override public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { if (!fpmListener.peerConnected(ctx.getChannel().getRemoteAddress())) { log.error("Received new FPM connection while already connected"); ctx.getChannel().close(); return; } channel = ctx.getChannel(); }
@Override public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent channelEvent) { localInfo.setAddress(ctx.getChannel().getLocalAddress()); remoteInfo.setAddress(ctx.getChannel().getRemoteAddress()); // Assign the local and remote IPv4 addresses InetAddress inetAddr; if (localInfo.address() instanceof InetSocketAddress) { inetAddr = ((InetSocketAddress) localInfo.address()).getAddress(); localInfo.setIp4Address(Ip4Address.valueOf(inetAddr.getAddress())); } if (remoteInfo.address() instanceof InetSocketAddress) { inetAddr = ((InetSocketAddress) remoteInfo.address()).getAddress(); remoteInfo.setIp4Address(Ip4Address.valueOf(inetAddr.getAddress())); } log.debug("BGP Session Connected from {} on {}", remoteInfo.address(), localInfo.address()); if (!bgpSessionManager.peerConnected(this)) { log.debug("Cannot setup BGP Session Connection from {}. Closing...", remoteInfo.address()); ctx.getChannel().close(); } // // Assign the local BGP ID // NOTE: This should be configuration-based // localInfo.setBgpId(bgpSessionManager.getMyBgpId()); }
@Override public void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent channelEvent) { log.debug("BGP Session Disconnected from {} on {}", ctx.getChannel().getRemoteAddress(), ctx.getChannel().getLocalAddress()); processChannelDisconnected(); }
@Override public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent channelEvent) { this.savedCtx = ctx; // Prepare and transmit BGP OPEN message ChannelBuffer message = BgpOpen.prepareBgpOpen(localInfo); ctx.getChannel().write(message); // Prepare and transmit BGP KEEPALIVE message message = BgpKeepalive.prepareBgpKeepalive(); ctx.getChannel().write(message); }
@Override public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { channelState = ChannelState.CONNECTED; HelloMessage m = new HelloMessage(); if (getLocalNodeId() != null) m.setNodeId(getLocalNodeId()); AsyncMessageHeader header = new AsyncMessageHeader(); header.setTransactionId(getTransactionId()); m.setHeader(header); switch (getAuthScheme()) { case NO_AUTH: channelState = ChannelState.AUTHENTICATED; m.setAuthScheme(org.sdnplatform.sync.thrift. AuthScheme.NO_AUTH); break; case CHALLENGE_RESPONSE: AuthChallengeResponse cr = new AuthChallengeResponse(); cr.setChallenge(generateChallenge()); m.setAuthScheme(org.sdnplatform.sync.thrift. AuthScheme.CHALLENGE_RESPONSE); m.setAuthChallengeResponse(cr); break; } SyncMessage bsm = new SyncMessage(MessageType.HELLO); bsm.setHello(m); ctx.getChannel().write(bsm); }