@Override public void run() { boolean fireConnected = channel instanceof OioAcceptedSocketChannel; if (fireConnected && channel.isOpen()) { // Fire the channelConnected event for OioAcceptedSocketChannel. // See #287 fireChannelConnected(channel, channel.getRemoteAddress()); } super.run(); }
private void fireInitialEvents() { // Fire the typical initial events. fireChannelOpen(channel); fireChannelBound(channel, channel.getLocalAddress()); fireChannelConnected(channel, channel.getRemoteAddress()); }
fireChannelBound(channel, channel.getLocalAddress()); fireChannelConnected(channel, channel.getRemoteAddress());
fireChannelBound(channel, localAddress); fireChannelConnected(channel, remoteAddress); } catch (IOException e) { if (future != null) {
requestHeaderWritten = true; future.setSuccess(); fireChannelConnected(virtualChannel, remoteAddress); } else { sslHandshakeFuture.addListener(new ChannelFutureListener() {
fireChannelConnected(channel, serverChannel.getLocalAddress()); acceptedChannel.remoteAddress = channel.getLocalAddress(); acceptedChannel.setConnected(); fireChannelConnected(acceptedChannel, channel.getLocalAddress());
fireChannelBound(channel, channel.getLocalAddress()); fireChannelConnected(channel, channel.getRemoteAddress());
fireChannelBound(channel, channel.getLocalAddress()); fireChannelConnected(channel, channel.getRemoteAddress());
@Override public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception { checkNotNull(remoteAddress); // we assume that the framing handler is downstream, // and that the handshake is coming to us in one piece ChannelBuffer incomingHandshakeBuffer = (ChannelBuffer) e.getMessage(); Handshake handshake = getHandshakeFromBuffer(incomingHandshakeBuffer, mapper); // set the channel attachment, remove this handler, and then pass a "channelConnected" event on ctx.getChannel().setAttachment(handshake.getServerId()); ctx.getPipeline().remove(this); Channels.fireChannelConnected(ctx, remoteAddress); } }
@Override public void run() { clientChannel.setRemoteAddress(remoteAddress); clientChannel.setConnected(); fireChannelConnected(clientChannel, clientChannel.getRemoteAddress()); connectFuture.setSuccess(); clientChannel.worker.register(clientChannel); }
private void fireInitialEvents() { // Fire the typical initial events. fireChannelOpen( channel ); fireChannelBound( channel, channel.getLocalAddress() ); fireChannelConnected( channel, channel.getRemoteAddress() ); }
fireChannelConnected(channel, remoteAddress); } catch (final IOException e) { if (future != null) {
fireChannelConnected(channel, remoteAddress); } catch (final IOException e) { if (future != null) {
@Override @SuppressWarnings("unchecked") public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception { S serverChannel = (S) ctx.getAttachment(); T childChannel = createChildChannel(serverChannel, e.getChannel()); fireChannelOpen(childChannel); ChannelAddress localAddress = serverChannel.getLocalAddress(); childChannel.setLocalAddress(localAddress); childChannel.setBound(); fireChannelBound(childChannel, localAddress); ctx.setAttachment(childChannel); ctx.sendUpstream(e); // TODO: fire CONNECTED_BARRIER event to next pipeline // then fire CONNECTED event when future completes successfully ChannelAddress remoteAddress = localAddress.newEphemeralAddress(); childChannel.setRemoteAddress(remoteAddress); childChannel.setConnected(); fireChannelConnected(childChannel, remoteAddress); }
@Override protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer in) { if(in.readableBytes() < 1 + RtmpHandshake.HANDSHAKE_SIZE * 2) { return null; } handshake.decodeServerAll(in); Channels.write(ctx, Channels.succeededFuture(channel), handshake.encodeClient2()); handshakeDone = true; rtmpe = handshake.isRtmpe(); // rare chance server refused rtmpe if(handshake.getSwfvBytes() != null) { ClientHandler clientHandler = channel.getPipeline().get(ClientHandler.class); clientHandler.setSwfvBytes(handshake.getSwfvBytes()); } if(!rtmpe) { channel.getPipeline().remove(this); } Channels.fireChannelConnected(ctx, channel.getRemoteAddress()); return in; }
childChannel.setRemoteAddress(address); childChannel.setConnected(); fireChannelConnected(childChannel, e.getRemoteAddress());
@Override protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer in) { if(in.readableBytes() < 1 + RtmpHandshake.HANDSHAKE_SIZE * 2) { return null; } handshake.decodeServerAll(in); Channels.write(ctx, Channels.succeededFuture(channel), handshake.encodeClient2()); handshakeDone = true; rtmpe = handshake.isRtmpe(); // rare chance server refused rtmpe if(handshake.getSwfvBytes() != null) { ClientHandler clientHandler = channel.getPipeline().get(ClientHandler.class); clientHandler.setSwfvBytes(handshake.getSwfvBytes()); } if(!rtmpe) { channel.getPipeline().remove(this); } Channels.fireChannelConnected(ctx, channel.getRemoteAddress()); return in; }
@Override protected void connectRequested(ChannelPipeline pipeline, ChannelStateEvent evt) throws Exception { if (LOGGER.isDebugEnabled()) { LOGGER.debug("connectRequested pipeline = " + pipeline + " evt = " + evt); } FileChannel fileChannel = (FileChannel) evt.getChannel(); ChannelAddress fileAddress = (ChannelAddress) evt.getValue(); if (!fileChannel.isBound()) { fileChannel.setLocalAddress(fileAddress); fileChannel.setBound(); fireChannelBound(fileChannel, fileAddress); } ChannelFuture connectFuture = evt.getFuture(); try { fileChannel.mapFile(); connectFuture.setSuccess(); } catch (Throwable t) { connectFuture.setFailure(t); } fileChannel.setConnected(); Channels.fireChannelConnected(fileChannel, fileAddress); // Send a read event using memory mapped buffer contents so that reads in the // scripts can be matched fileChannel.fireMessageReceived(fileChannel, fileAddress); }
@Override public void operationComplete(ChannelFuture connectFuture) throws Exception { if (connectFuture.isSuccess()) { transport = connectFuture.getChannel(); transport.getConfig().setBufferFactory(httpConnectConfig.getBufferFactory()); ChannelPipeline pipeline = transport.getPipeline(); ChannelHandlerContext ctx = pipeline.getContext(HttpClientChannelSource.class); HttpClientChannelSource channelSource = (HttpClientChannelSource) ctx.getHandler(); if (!httpConnectChannel.isBound()) { ChannelAddress httpLocalAddress = httpRemoteAddress; httpConnectChannel.setLocalAddress(httpLocalAddress); httpConnectChannel.setBound(); fireChannelBound(httpConnectChannel, httpLocalAddress); } channelSource.setHttpChannel(httpConnectChannel); httpConnectChannel.setRemoteAddress(httpRemoteAddress); httpConnectChannel.setConnected(); httpConnectFuture.setSuccess(); fireChannelConnected(httpConnectChannel, httpRemoteAddress); } else { httpConnectFuture.setFailure(connectFuture.getCause()); } } });
@Override public void run() { serverChannel.setLocalAddress(localAddress); serverChannel.setBound(); fireChannelBound(serverChannel, serverChannel.getLocalAddress()); try { ChannelPipelineFactory pipelineFactory = serverChannel.getConfig().getPipelineFactory(); ChannelPipeline pipeline = pipelineFactory.getPipeline(); bindFuture.setSuccess(); // fire child channel opened ChannelFactory channelFactory = serverChannel.getFactory(); AgronaChildChannelSink channelSink = new AgronaChildChannelSink(); AgronaChildChannel childChannel = new AgronaChildChannel(serverChannel, channelFactory, pipeline, channelSink, serverChannel.worker); childChannel.setLocalAddress(serverChannel.getLocalAddress()); fireChannelBound(childChannel, childChannel.getLocalAddress()); childChannel.setRemoteAddress(childChannel.getLocalAddress()); Channels.fireChannelConnected(childChannel, childChannel.getRemoteAddress()); childChannel.worker.register(childChannel); } catch (Exception e) { bindFuture.setFailure(e); } }