proxygen
HTTPServerAcceptor.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree. An additional grant
7  * of patent rights can be found in the PATENTS file in the same directory.
8  *
9  */
10 #pragma once
11 
15 
16 namespace proxygen {
17 
19  public:
21  const HTTPServer::IPConfig& ipConfig,
22  const HTTPServerOptions& opts);
23 
24  static std::unique_ptr<HTTPServerAcceptor> make(
25  const AcceptorConfiguration& conf,
26  const HTTPServerOptions& opts,
27  const std::shared_ptr<HTTPCodecFactory>& codecFactory = nullptr);
28 
32  void setCompletionCallback(std::function<void()> f);
33 
34  ~HTTPServerAcceptor() override;
35 
36  private:
38  const std::shared_ptr<HTTPCodecFactory>& codecFactory,
39  std::vector<RequestHandlerFactory*> handlerFactories,
40  const HTTPServerOptions& options);
41 
42  // HTTPSessionAcceptor
44  HTTPMessage* msg) noexcept override;
45 
47  const folly::SocketAddress* address,
48  const std::string& nextProtocolName,
49  wangle::SecureTransportType secureTransportType,
50  const wangle::TransportInfo& tinfo) override;
51 
52  void onConnectionsDrained() override;
53 
55  std::function<void()> completionCallback_;
56  const std::vector<RequestHandlerFactory*> handlerFactories_{nullptr};
57 };
58 
59 }
HTTPTransaction::Handler * newHandler(HTTPTransaction &txn, HTTPMessage *msg) noexceptoverride
static AcceptorConfiguration makeConfig(const HTTPServer::IPConfig &ipConfig, const HTTPServerOptions &opts)
auto f
const HTTPServerOptions & serverOptions_
std::function< void()> completionCallback_
requires E e noexcept(noexcept(s.error(std::move(e))))
HTTPServerAcceptor(const AcceptorConfiguration &conf, const std::shared_ptr< HTTPCodecFactory > &codecFactory, std::vector< RequestHandlerFactory * > handlerFactories, const HTTPServerOptions &options)
std::unique_ptr< AsyncTransportWrapper, Destructor > UniquePtr
void onNewConnection(folly::AsyncTransportWrapper::UniquePtr sock, const folly::SocketAddress *address, const std::string &nextProtocolName, wangle::SecureTransportType secureTransportType, const wangle::TransportInfo &tinfo) override
const char * string
Definition: Conv.cpp:212
const std::vector< RequestHandlerFactory * > handlerFactories_
void setCompletionCallback(std::function< void()> f)
static std::unique_ptr< HTTPServerAcceptor > make(const AcceptorConfiguration &conf, const HTTPServerOptions &opts, const std::shared_ptr< HTTPCodecFactory > &codecFactory=nullptr)