1#pragma once 2#include "Common.h" 3#include "Socket.h" 4 5#include "TlsContext.h" 6 7#include <memory> 8 9class InetAddress; 10 11class TlsStream; 12typedef std::unique_ptr<TlsStream> TlsStreamPtr; 13 14class TlsAcceptor : noncopyable 15{ 16 public: 17 TlsAcceptor(TlsConfig* config, const InetAddress& listenAddr); 18 19 ~TlsAcceptor() = default; 20 TlsAcceptor(TlsAcceptor&&) = default; 21 TlsAcceptor& operator=(TlsAcceptor&&) = default; 22 23 // thread safe 24 TlsStreamPtr accept(); 25 26 private: 27 TlsContext context_; 28 Socket listenSock_; 29}; 30 31 32