2021-11-28 15:29:26 +08:00
|
|
|
// Copyright 2021, Roman Gershman. All rights reserved.
|
|
|
|
// See LICENSE for licensing terms.
|
2021-11-16 16:39:38 +08:00
|
|
|
//
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "util/listener_interface.h"
|
2021-12-21 04:46:51 +08:00
|
|
|
#include "server/common_types.h"
|
2021-11-16 16:39:38 +08:00
|
|
|
|
2021-11-20 00:00:14 +08:00
|
|
|
typedef struct ssl_ctx_st SSL_CTX;
|
|
|
|
|
2021-11-16 16:39:38 +08:00
|
|
|
namespace dfly {
|
|
|
|
|
|
|
|
class Service;
|
|
|
|
|
|
|
|
class Listener : public util::ListenerInterface {
|
|
|
|
public:
|
2021-11-23 18:39:35 +08:00
|
|
|
Listener(Protocol protocol, Service*);
|
2021-11-16 16:39:38 +08:00
|
|
|
~Listener();
|
|
|
|
|
|
|
|
private:
|
|
|
|
util::Connection* NewConnection(util::ProactorBase* proactor) final;
|
|
|
|
util::ProactorBase* PickConnectionProactor(util::LinuxSocketBase* sock) final;
|
|
|
|
|
|
|
|
void PreShutdown();
|
|
|
|
|
|
|
|
void PostShutdown();
|
|
|
|
|
|
|
|
Service* engine_;
|
|
|
|
|
|
|
|
std::atomic_uint32_t next_id_{0};
|
2021-11-23 18:39:35 +08:00
|
|
|
Protocol protocol_;
|
2021-11-20 00:00:14 +08:00
|
|
|
SSL_CTX* ctx_ = nullptr;
|
2021-11-16 16:39:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dfly
|