Commit 1cb4f91b authored by Sean Cannella's avatar Sean Cannella Committed by Alecs King

Reduce AsyncSocket code size

Summary:
Manual inspection of AsyncSocket.o shows the constructors are generating ugly
(and large) code. Call the smaller constructors instead of duplicating the code. This
reduces the debug .o size from ~1.9MB to ~1.6MB.

Test Plan: existing tests

Reviewed By: benyluo@fb.com

Subscribers: mzlee, folly-diffs@, yfeldblum, mathieubaudet, subodh, pgriess, benyluo

FB internal diff: D1870896

Signature: t1:1870896:1424885638:d37fc79c0f88d04109c8bb73e632dc506b9f773b
parent 0f6e3043
...@@ -179,7 +179,7 @@ AsyncSocket::AsyncSocket() ...@@ -179,7 +179,7 @@ AsyncSocket::AsyncSocket()
: eventBase_(nullptr) : eventBase_(nullptr)
, writeTimeout_(this, nullptr) , writeTimeout_(this, nullptr)
, ioHandler_(this, nullptr) { , ioHandler_(this, nullptr) {
VLOG(5) << "new AsyncSocket(" << ")"; VLOG(5) << "new AsyncSocket()";
init(); init();
} }
...@@ -194,11 +194,7 @@ AsyncSocket::AsyncSocket(EventBase* evb) ...@@ -194,11 +194,7 @@ AsyncSocket::AsyncSocket(EventBase* evb)
AsyncSocket::AsyncSocket(EventBase* evb, AsyncSocket::AsyncSocket(EventBase* evb,
const folly::SocketAddress& address, const folly::SocketAddress& address,
uint32_t connectTimeout) uint32_t connectTimeout)
: eventBase_(evb) : AsyncSocket(evb) {
, writeTimeout_(this, evb)
, ioHandler_(this, evb) {
VLOG(5) << "new AsyncSocket(" << this << ", evb=" << evb << ")";
init();
connect(nullptr, address, connectTimeout); connect(nullptr, address, connectTimeout);
} }
...@@ -206,11 +202,7 @@ AsyncSocket::AsyncSocket(EventBase* evb, ...@@ -206,11 +202,7 @@ AsyncSocket::AsyncSocket(EventBase* evb,
const std::string& ip, const std::string& ip,
uint16_t port, uint16_t port,
uint32_t connectTimeout) uint32_t connectTimeout)
: eventBase_(evb) : AsyncSocket(evb) {
, writeTimeout_(this, evb)
, ioHandler_(this, evb) {
VLOG(5) << "new AsyncSocket(" << this << ", evb=" << evb << ")";
init();
connect(nullptr, ip, port, connectTimeout); connect(nullptr, ip, port, connectTimeout);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment