private void evSet0(short filter, short flags, int fflags) { ((KQueueEventLoop) eventLoop()).evSet(this, filter, flags, fflags); }
private void evSet0(short filter, short flags, int fflags) { ((KQueueEventLoop) eventLoop()).evSet(this, filter, flags, fflags); }
final void executeReadReadyRunnable(ChannelConfig config) { if (readReadyRunnablePending || !isActive() || shouldBreakReadReady(config)) { return; } readReadyRunnablePending = true; eventLoop().execute(readReadyRunnable); }
@Override protected void doDeregister() throws Exception { // Make sure we unregister our filters from kqueue! readFilter(false); writeFilter(false); evSet0(Native.EVFILT_SOCK, Native.EV_DELETE, 0); ((KQueueEventLoop) eventLoop()).remove(this); }
final void executeReadReadyRunnable(ChannelConfig config) { if (readReadyRunnablePending || !isActive() || shouldBreakReadReady(config)) { return; } readReadyRunnablePending = true; eventLoop().execute(readReadyRunnable); }
@Override protected void doRegister() throws Exception { // Just in case the previous EventLoop was shutdown abruptly, or an event is still pending on the old EventLoop // make sure the readReadyRunnablePending variable is reset so we will be able to execute the Runnable on the // new EventLoop. readReadyRunnablePending = false; ((KQueueEventLoop) eventLoop()).add(this); // Add the write event first so we get notified of connection refused on the client side! if (writeFilterEnabled) { evSet0(Native.EVFILT_WRITE, Native.EV_ADD_CLEAR_ENABLE); } if (readFilterEnabled) { evSet0(Native.EVFILT_READ, Native.EV_ADD_CLEAR_ENABLE); } evSet0(Native.EVFILT_SOCK, Native.EV_ADD, Native.NOTE_RDHUP); }
@Override protected void doDeregister() throws Exception { // Make sure we unregister our filters from kqueue! readFilter(false); writeFilter(false); evSet0(Native.EVFILT_SOCK, Native.EV_DELETE, 0); ((KQueueEventLoop) eventLoop()).remove(this); }
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; } } }
final void clearReadFilter() { // Only clear if registered with an EventLoop as otherwise if (isRegistered()) { final EventLoop loop = eventLoop(); final AbstractKQueueUnsafe unsafe = (AbstractKQueueUnsafe) unsafe(); if (loop.inEventLoop()) { unsafe.clearReadFilter0(); } else { // schedule a task to clear the EPOLLIN as it is not safe to modify it directly loop.execute(new Runnable() { @Override public void run() { if (!unsafe.readPending && !config().isAutoRead()) { // Still no read triggered so clear it now unsafe.clearReadFilter0(); } } }); } } else { // The EventLoop is not registered atm so just update the flags so the correct value // will be used once the channel is registered readFilterEnabled = false; } }
EventLoop loop = eventLoop(); if (loop.inEventLoop()) { doDeregister();
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; } } }
protected final void clearReadFilter0() { assert eventLoop().inEventLoop(); try { readPending = false; readFilter(false); } catch (IOException e) { // When this happens there is something completely wrong with either the filedescriptor or epoll, // so fire the exception through the pipeline and close the Channel. pipeline().fireExceptionCaught(e); unsafe().close(unsafe().voidPromise()); } }
final void clearReadFilter() { // Only clear if registered with an EventLoop as otherwise if (isRegistered()) { final EventLoop loop = eventLoop(); final AbstractKQueueUnsafe unsafe = (AbstractKQueueUnsafe) unsafe(); if (loop.inEventLoop()) { unsafe.clearReadFilter0(); } else { // schedule a task to clear the EPOLLIN as it is not safe to modify it directly loop.execute(new Runnable() { @Override public void run() { if (!unsafe.readPending && !config().isAutoRead()) { // Still no read triggered so clear it now unsafe.clearReadFilter0(); } } }); } } else { // The EventLoop is not registered atm so just update the flags so the correct value // will be used once the channel is registered readFilterEnabled = false; } }
EventLoop loop = eventLoop(); if (loop.inEventLoop()) { doDeregister();
protected final void clearReadFilter0() { assert eventLoop().inEventLoop(); try { readPending = false; readFilter(false); } catch (IOException e) { // When this happens there is something completely wrong with either the filedescriptor or epoll, // so fire the exception through the pipeline and close the Channel. pipeline().fireExceptionCaught(e); unsafe().close(unsafe().voidPromise()); } }
connectTimeoutFuture = eventLoop().schedule(new Runnable() { @Override public void run() {
connectTimeoutFuture = eventLoop().schedule(new Runnable() { @Override public void run() {
@Override protected void doDeregister() throws Exception { // Make sure we unregister our filters from kqueue! readFilter(false); writeFilter(false); evSet0(Native.EVFILT_SOCK, Native.EV_DELETE, 0); ((KQueueEventLoop) eventLoop()).remove(this); }
@Override protected void doDeregister() throws Exception { // Make sure we unregister our filters from kqueue! readFilter(false); writeFilter(false); evSet0(Native.EVFILT_SOCK, Native.EV_DELETE, 0); ((KQueueEventLoop) eventLoop()).remove(this); }
protected final void clearReadFilter0() { assert eventLoop().inEventLoop(); try { readPending = false; readFilter(false); } catch (IOException e) { // When this happens there is something completely wrong with either the filedescriptor or epoll, // so fire the exception through the pipeline and close the Channel. pipeline().fireExceptionCaught(e); unsafe().close(unsafe().voidPromise()); } }