final void executeReadReadyRunnable(ChannelConfig config) { if (readReadyRunnablePending || !isActive() || shouldBreakReadReady(config)) { return; } readReadyRunnablePending = true; eventLoop().execute(readReadyRunnable); }
final void executeReadReadyRunnable(ChannelConfig config) { if (readReadyRunnablePending || !isActive() || shouldBreakReadReady(config)) { return; } readReadyRunnablePending = true; eventLoop().execute(readReadyRunnable); }
final void readEOF() { // This must happen before we attempt to read. This will ensure reading continues until an error occurs. final KQueueRecvByteAllocatorHandle allocHandle = recvBufAllocHandle(); allocHandle.readEOF(); if (isActive()) { // If it is still active, we need to call readReady as otherwise we may miss to // read pending data from the underlying file descriptor. // See https://github.com/netty/netty/issues/3709 readReady(allocHandle); } else { // Just to be safe make sure the input marked as closed. shutdownInput(true); } }
final void readEOF() { // This must happen before we attempt to read. This will ensure reading continues until an error occurs. final KQueueRecvByteAllocatorHandle allocHandle = recvBufAllocHandle(); allocHandle.readEOF(); if (isActive()) { // If it is still active, we need to call readReady as otherwise we may miss to // read pending data from the underlying file descriptor. // See https://github.com/netty/netty/issues/3709 readReady(allocHandle); } else { // Just to be safe make sure the input marked as closed. shutdownInput(true); } }
private void finishConnect() { // Note this method is invoked by the event loop only if the connection attempt was // neither cancelled nor timed out. assert eventLoop().inEventLoop(); boolean connectStillInProgress = false; try { boolean wasActive = isActive(); if (!doFinishConnect()) { connectStillInProgress = true; return; } fulfillConnectPromise(connectPromise, wasActive); } catch (Throwable t) { fulfillConnectPromise(connectPromise, annotateConnectException(t, requestedRemoteAddress)); } finally { if (!connectStillInProgress) { // Check for null as the connectTimeoutFuture is only created if a connectTimeoutMillis > 0 is used // See https://github.com/netty/netty/issues/1770 if (connectTimeoutFuture != null) { connectTimeoutFuture.cancel(false); } connectPromise = null; } } }
private void fulfillConnectPromise(ChannelPromise promise, boolean wasActive) { if (promise == null) { // Closed via cancellation and the promise has been notified already. return; } active = true; // Get the state as trySuccess() may trigger an ChannelFutureListener that will close the Channel. // We still need to ensure we call fireChannelActive() in this case. boolean active = isActive(); // trySuccess() will return false if a user cancelled the connection attempt. boolean promiseSet = promise.trySuccess(); // Regardless if the connection attempt was cancelled, channelActive() event should be triggered, // because what happened is what happened. if (!wasActive && active) { pipeline().fireChannelActive(); } // If a user cancelled the connection attempt, close the channel, which is followed by channelInactive(). if (!promiseSet) { close(voidPromise()); } }
private void finishConnect() { // Note this method is invoked by the event loop only if the connection attempt was // neither cancelled nor timed out. assert eventLoop().inEventLoop(); boolean connectStillInProgress = false; try { boolean wasActive = isActive(); if (!doFinishConnect()) { connectStillInProgress = true; return; } fulfillConnectPromise(connectPromise, wasActive); } catch (Throwable t) { fulfillConnectPromise(connectPromise, annotateConnectException(t, requestedRemoteAddress)); } finally { if (!connectStillInProgress) { // Check for null as the connectTimeoutFuture is only created if a connectTimeoutMillis > 0 is used // See https://github.com/netty/netty/issues/1770 if (connectTimeoutFuture != null) { connectTimeoutFuture.cancel(false); } connectPromise = null; } } }
private void fulfillConnectPromise(ChannelPromise promise, boolean wasActive) { if (promise == null) { // Closed via cancellation and the promise has been notified already. return; } active = true; // Get the state as trySuccess() may trigger an ChannelFutureListener that will close the Channel. // We still need to ensure we call fireChannelActive() in this case. boolean active = isActive(); // trySuccess() will return false if a user cancelled the connection attempt. boolean promiseSet = promise.trySuccess(); // Regardless if the connection attempt was cancelled, channelActive() event should be triggered, // because what happened is what happened. if (!wasActive && active) { pipeline().fireChannelActive(); } // If a user cancelled the connection attempt, close the channel, which is followed by channelInactive(). if (!promiseSet) { close(voidPromise()); } }
boolean wasActive = isActive(); if (doConnect(remoteAddress, localAddress)) { fulfillConnectPromise(promise, wasActive);
boolean wasActive = isActive(); if (doConnect(remoteAddress, localAddress)) { fulfillConnectPromise(promise, wasActive);
final void executeReadReadyRunnable(ChannelConfig config) { if (readReadyRunnablePending || !isActive() || shouldBreakReadReady(config)) { return; } readReadyRunnablePending = true; eventLoop().execute(readReadyRunnable); }
final void executeReadReadyRunnable(ChannelConfig config) { if (readReadyRunnablePending || !isActive() || shouldBreakReadReady(config)) { return; } readReadyRunnablePending = true; eventLoop().execute(readReadyRunnable); }
final void executeReadReadyRunnable(ChannelConfig config) { if (readReadyRunnablePending || !isActive() || shouldBreakReadReady(config)) { return; } readReadyRunnablePending = true; eventLoop().execute(readReadyRunnable); }
final void executeReadReadyRunnable(ChannelConfig config) { if (readReadyRunnablePending || !isActive() || shouldBreakReadReady(config)) { return; } readReadyRunnablePending = true; eventLoop().execute(readReadyRunnable); }
final void readEOF() { // This must happen before we attempt to read. This will ensure reading continues until an error occurs. final KQueueRecvByteAllocatorHandle allocHandle = recvBufAllocHandle(); allocHandle.readEOF(); if (isActive()) { // If it is still active, we need to call readReady as otherwise we may miss to // read pending data from the underlying file descriptor. // See https://github.com/netty/netty/issues/3709 readReady(allocHandle); } else { // Just to be safe make sure the input marked as closed. shutdownInput(true); } }
final void readEOF() { // This must happen before we attempt to read. This will ensure reading continues until an error occurs. final KQueueRecvByteAllocatorHandle allocHandle = recvBufAllocHandle(); allocHandle.readEOF(); if (isActive()) { // If it is still active, we need to call readReady as otherwise we may miss to // read pending data from the underlying file descriptor. // See https://github.com/netty/netty/issues/3709 readReady(allocHandle); } else { // Just to be safe make sure the input marked as closed. shutdownInput(true); } }
final void readEOF() { // This must happen before we attempt to read. This will ensure reading continues until an error occurs. final KQueueRecvByteAllocatorHandle allocHandle = recvBufAllocHandle(); allocHandle.readEOF(); if (isActive()) { // If it is still active, we need to call readReady as otherwise we may miss to // read pending data from the underlying file descriptor. // See https://github.com/netty/netty/issues/3709 readReady(allocHandle); } else { // Just to be safe make sure the input marked as closed. shutdownInput(true); } }
final void readEOF() { // This must happen before we attempt to read. This will ensure reading continues until an error occurs. final KQueueRecvByteAllocatorHandle allocHandle = recvBufAllocHandle(); allocHandle.readEOF(); if (isActive()) { // If it is still active, we need to call readReady as otherwise we may miss to // read pending data from the underlying file descriptor. // See https://github.com/netty/netty/issues/3709 readReady(allocHandle); } else { // Just to be safe make sure the input marked as closed. shutdownInput(true); } }
private void fulfillConnectPromise(ChannelPromise promise, boolean wasActive) { if (promise == null) { // Closed via cancellation and the promise has been notified already. return; } active = true; // Get the state as trySuccess() may trigger an ChannelFutureListener that will close the Channel. // We still need to ensure we call fireChannelActive() in this case. boolean active = isActive(); // trySuccess() will return false if a user cancelled the connection attempt. boolean promiseSet = promise.trySuccess(); // Regardless if the connection attempt was cancelled, channelActive() event should be triggered, // because what happened is what happened. if (!wasActive && active) { pipeline().fireChannelActive(); } // If a user cancelled the connection attempt, close the channel, which is followed by channelInactive(). if (!promiseSet) { close(voidPromise()); } }
private void fulfillConnectPromise(ChannelPromise promise, boolean wasActive) { if (promise == null) { // Closed via cancellation and the promise has been notified already. return; } active = true; // Get the state as trySuccess() may trigger an ChannelFutureListener that will close the Channel. // We still need to ensure we call fireChannelActive() in this case. boolean active = isActive(); // trySuccess() will return false if a user cancelled the connection attempt. boolean promiseSet = promise.trySuccess(); // Regardless if the connection attempt was cancelled, channelActive() event should be triggered, // because what happened is what happened. if (!wasActive && active) { pipeline().fireChannelActive(); } // If a user cancelled the connection attempt, close the channel, which is followed by channelInactive(). if (!promiseSet) { close(voidPromise()); } }