23 using namespace folly;
35 gflags::ParseCommandLineFlags(&argc, &argv,
true);
37 if (FLAGS_port == 0) {
38 LOG(ERROR) <<
"Must specify port";
46 auto sslContext = std::make_shared<SSLContext>();
51 socket->detachEventBase();
59 if (FLAGS_sendtimeout_ms != 0) {
60 socket->setSendTimeout(FLAGS_sendtimeout_ms);
64 auto sockAddr = socket.get();
70 std::chrono::milliseconds
timeout(FLAGS_timeout_ms);
74 for (
int32_t i = 0;
i < FLAGS_num_writes; ++
i) {
75 sock.
write((
const uint8_t*)FLAGS_msg.data(), FLAGS_msg.size());
78 LOG(
INFO) <<
"TFO attempted: " << sockAddr->getTFOAttempted();
79 LOG(
INFO) <<
"TFO finished: " << sockAddr->getTFOFinished();
80 LOG(
INFO) <<
"TFO success: " << sockAddr->getTFOSucceded();
82 std::array<char, 1024> buf;
84 while ((bytesRead = sock.
read((
uint8_t*)buf.data(), buf.size())) != 0) {
DEFINE_bool(tfo, false,"enable tfo")
DEFINE_string(host,"localhost","Host")
void open(std::chrono::milliseconds timeout=std::chrono::milliseconds::zero())
void setFromHostPort(const char *host, uint16_t port)
int main(int argc, char **argv)
void setAddress(folly::SocketAddress address)
constexpr detail::Map< Move > move
—— Concurrent Priority Queue Implementation ——
NetworkSocket socket(int af, int type, int protocol)
int32_t read(uint8_t *buf, size_t len)
DEFINE_int32(port, 0,"port")
ThreadPoolListHook * addr
std::unique_ptr< AsyncSocket, Destructor > UniquePtr
int32_t write(uint8_t const *buf, size_t len)
std::string getAddressStr() const