#ifndef TILE_IO_NATIVE_ACCEPTOR_H
#define TILE_IO_NATIVE_ACCEPTOR_H

#pragma once

#include "tile/io/acceptor.h"
#include "tile/io/descriptor.h"

namespace tile {
class NativeAcceptor final : public Descriptor, public Acceptor {
public:
    struct Options {
        std::function<void(Handle fd, Endpoint peer)> connection_handler;
    };

    explicit NativeAcceptor(Handle fd, Options options);
    void Stop() override;
    void Join() override;

private:
    EventAction OnReadable() override;
    EventAction OnWritable() override;// Abort on call.
    void OnError(int err) override;
    void OnCleanup(CleanupReason reason) override;

private:
    Options options_;
};
}// namespace tile

#endif// TILE_IO_NATIVE_ACCEPTOR_H
