package io.netty.channel.epoll;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.ChannelConfig;
import io.netty.channel.RecvByteBufAllocator;
import io.netty.util.UncheckedBooleanSupplier;
import io.netty.util.internal.ObjectUtil;

/* JADX INFO: loaded from: classes.dex */
public class EpollRecvByteAllocatorHandle implements RecvByteBufAllocator.ExtendedHandle {
    private final UncheckedBooleanSupplier defaultMaybeMoreDataSupplier = new UncheckedBooleanSupplier() { // from class: io.netty.channel.epoll.EpollRecvByteAllocatorHandle.1
        @Override // io.netty.util.UncheckedBooleanSupplier, io.netty.util.BooleanSupplier
        public boolean get() {
            return EpollRecvByteAllocatorHandle.this.maybeMoreDataToRead();
        }
    };
    private final RecvByteBufAllocator.ExtendedHandle delegate;
    private boolean isEdgeTriggered;
    private boolean receivedRdHup;

    public EpollRecvByteAllocatorHandle(RecvByteBufAllocator.ExtendedHandle extendedHandle) {
        this.delegate = (RecvByteBufAllocator.ExtendedHandle) ObjectUtil.checkNotNull(extendedHandle, "handle");
    }

    @Override // io.netty.channel.RecvByteBufAllocator.Handle
    public final ByteBuf allocate(ByteBufAllocator byteBufAllocator) {
        return this.delegate.allocate(byteBufAllocator);
    }

    @Override // io.netty.channel.RecvByteBufAllocator.Handle
    public final int attemptedBytesRead() {
        return this.delegate.attemptedBytesRead();
    }

    @Override // io.netty.channel.RecvByteBufAllocator.Handle
    public final void attemptedBytesRead(int i2) {
        this.delegate.attemptedBytesRead(i2);
    }

    @Override // io.netty.channel.RecvByteBufAllocator.Handle
    public final boolean continueReading() {
        return this.delegate.continueReading(this.defaultMaybeMoreDataSupplier);
    }

    @Override // io.netty.channel.RecvByteBufAllocator.ExtendedHandle
    public final boolean continueReading(UncheckedBooleanSupplier uncheckedBooleanSupplier) {
        return this.delegate.continueReading(uncheckedBooleanSupplier);
    }

    public final void edgeTriggered(boolean z2) {
        this.isEdgeTriggered = z2;
    }

    @Override // io.netty.channel.RecvByteBufAllocator.Handle
    public final int guess() {
        return this.delegate.guess();
    }

    @Override // io.netty.channel.RecvByteBufAllocator.Handle
    public final void incMessagesRead(int i2) {
        this.delegate.incMessagesRead(i2);
    }

    public final boolean isEdgeTriggered() {
        return this.isEdgeTriggered;
    }

    public final boolean isReceivedRdHup() {
        return this.receivedRdHup;
    }

    @Override // io.netty.channel.RecvByteBufAllocator.Handle
    public final int lastBytesRead() {
        return this.delegate.lastBytesRead();
    }

    @Override // io.netty.channel.RecvByteBufAllocator.Handle
    public final void lastBytesRead(int i2) {
        this.delegate.lastBytesRead(i2);
    }

    public boolean maybeMoreDataToRead() {
        return (this.isEdgeTriggered && lastBytesRead() > 0) || (!this.isEdgeTriggered && lastBytesRead() == attemptedBytesRead()) || this.receivedRdHup;
    }

    @Override // io.netty.channel.RecvByteBufAllocator.Handle
    public final void readComplete() {
        this.delegate.readComplete();
    }

    public final void receivedRdHup() {
        this.receivedRdHup = true;
    }

    @Override // io.netty.channel.RecvByteBufAllocator.Handle
    public final void reset(ChannelConfig channelConfig) {
        this.delegate.reset(channelConfig);
    }
}
