proxygen
folly::SSLServerAcceptCallbackDelay Class Reference

#include <AsyncSSLSocketTest.h>

Inheritance diagram for folly::SSLServerAcceptCallbackDelay:
folly::SSLServerAcceptCallback folly::SSLServerAcceptCallbackBase folly::AsyncServerSocket::AcceptCallback

Public Member Functions

 SSLServerAcceptCallbackDelay (HandshakeCallback *hcb)
 
void connAccepted (const std::shared_ptr< folly::AsyncSSLSocket > &s) noexceptoverride
 
- Public Member Functions inherited from folly::SSLServerAcceptCallback
 SSLServerAcceptCallback (HandshakeCallback *hcb, uint32_t timeout=0)
 
 ~SSLServerAcceptCallback () override
 
- Public Member Functions inherited from folly::SSLServerAcceptCallbackBase
 SSLServerAcceptCallbackBase (HandshakeCallback *hcb)
 
 ~SSLServerAcceptCallbackBase () override
 
void acceptError (const std::exception &ex) noexceptoverride
 
void connectionAccepted (int fd, const SocketAddress &) noexceptoverride
 
void detach ()
 
- Public Member Functions inherited from folly::AsyncServerSocket::AcceptCallback
virtual ~AcceptCallback ()=default
 
virtual void acceptStarted () noexcept
 
virtual void acceptStopped () noexcept
 

Additional Inherited Members

- Public Attributes inherited from folly::SSLServerAcceptCallback
uint32_t timeout_
 
- Public Attributes inherited from folly::SSLServerAcceptCallbackBase
StateEnum state
 
HandshakeCallbackhcb_
 
std::shared_ptr< SSLContextctx_
 
std::shared_ptr< AsyncSSLSocketsocket_
 
EventBasebase_
 

Detailed Description

Definition at line 575 of file AsyncSSLSocketTest.h.

Constructor & Destructor Documentation

folly::SSLServerAcceptCallbackDelay::SSLServerAcceptCallbackDelay ( HandshakeCallback hcb)
inlineexplicit

Definition at line 577 of file AsyncSSLSocketTest.h.

578  : SSLServerAcceptCallback(hcb) {}
SSLServerAcceptCallback(HandshakeCallback *hcb, uint32_t timeout=0)

Member Function Documentation

void folly::SSLServerAcceptCallbackDelay::connAccepted ( const std::shared_ptr< folly::AsyncSSLSocket > &  s)
inlineoverridevirtualnoexcept

Reimplemented from folly::SSLServerAcceptCallback.

Definition at line 580 of file AsyncSSLSocketTest.h.

References folly::SSLServerAcceptCallback::connAccepted(), EXPECT_EQ, folly::AsyncSocket::getFd(), folly::netops::getsockopt(), s, folly::netops::setsockopt(), and folly::value().

581  {
582  auto sock = std::static_pointer_cast<AsyncSSLSocket>(s);
583 
584  std::cerr << "SSLServerAcceptCallbackDelay::connAccepted" << std::endl;
585  int fd = sock->getFd();
586 
587 #ifndef TCP_NOPUSH
588  {
589  // The accepted connection should already have TCP_NODELAY set
590  int value;
591  socklen_t valueLength = sizeof(value);
592  int rc = getsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &value, &valueLength);
593  EXPECT_EQ(rc, 0);
594  EXPECT_EQ(value, 1);
595  }
596 #endif
597 
598  // Unset the TCP_NODELAY option.
599  int value = 0;
600  socklen_t valueLength = sizeof(value);
601  int rc = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &value, valueLength);
602  EXPECT_EQ(rc, 0);
603 
604  rc = getsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &value, &valueLength);
605  EXPECT_EQ(rc, 0);
606  EXPECT_EQ(value, 0);
607 
609  }
int setsockopt(NetworkSocket s, int level, int optname, const void *optval, socklen_t optlen)
Definition: NetOps.cpp:384
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
void connAccepted(const std::shared_ptr< folly::AsyncSSLSocket > &s) noexceptoverride
int getsockopt(NetworkSocket s, int level, int optname, void *optval, socklen_t *optlen)
Definition: NetOps.cpp:112
static set< string > s
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)

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