proxygen
wangle::AsyncUDPServerSocketFactory Class Reference

#include <ServerSocketFactory.h>

Inheritance diagram for wangle::AsyncUDPServerSocketFactory:
wangle::ServerSocketFactory

Classes

class  ThreadSafeDestructor
 

Public Member Functions

std::shared_ptr< folly::AsyncSocketBasenewSocket (folly::SocketAddress address, int, bool reuse, const ServerSocketConfig &) override
 
void removeAcceptCB (std::shared_ptr< folly::AsyncSocketBase >, Acceptor *, folly::EventBase *) override
 
void addAcceptCB (std::shared_ptr< folly::AsyncSocketBase > s, Acceptor *callback, folly::EventBase *base) override
 
- Public Member Functions inherited from wangle::ServerSocketFactory
virtual ~ServerSocketFactory ()=default
 

Detailed Description

Definition at line 98 of file ServerSocketFactory.h.

Member Function Documentation

void wangle::AsyncUDPServerSocketFactory::addAcceptCB ( std::shared_ptr< folly::AsyncSocketBase s,
Acceptor callback,
folly::EventBase base 
)
inlineoverridevirtual

Implements wangle::ServerSocketFactory.

Definition at line 120 of file ServerSocketFactory.h.

References s, and folly::netops::socket().

121  {
122  auto socket = std::dynamic_pointer_cast<folly::AsyncUDPServerSocket>(s);
123  DCHECK(socket);
124  socket->addListener(base, callback);
125  }
NetworkSocket socket(int af, int type, int protocol)
Definition: NetOps.cpp:412
static set< string > s
std::shared_ptr<folly::AsyncSocketBase> wangle::AsyncUDPServerSocketFactory::newSocket ( folly::SocketAddress  address,
int  ,
bool  reuse,
const ServerSocketConfig  
)
inlineoverridevirtual

Implements wangle::ServerSocketFactory.

Definition at line 100 of file ServerSocketFactory.h.

References folly::EventBaseManager::get(), folly::EventBaseManager::getEventBase(), and folly::netops::socket().

102  {
103 
105  std::shared_ptr<folly::AsyncUDPServerSocket> socket(
107  ThreadSafeDestructor());
108  socket->setReusePort(reuse);
109  socket->bind(address);
110  socket->listen();
111 
112  return socket;
113  }
EventBase * getEventBase() const
static EventBaseManager * get()
NetworkSocket socket(int af, int type, int protocol)
Definition: NetOps.cpp:412
void wangle::AsyncUDPServerSocketFactory::removeAcceptCB ( std::shared_ptr< folly::AsyncSocketBase ,
Acceptor ,
folly::EventBase  
)
inlineoverridevirtual

Implements wangle::ServerSocketFactory.

Definition at line 115 of file ServerSocketFactory.h.

117  {
118  }

The documentation for this class was generated from the following file: