Move small fields to avoid padding in AsyncSocket.h and AsyncSSLSocket.h
authorRichard Fillman <rfillman@fb.com>
Thu, 19 Oct 2017 00:19:59 +0000 (17:19 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 19 Oct 2017 00:21:05 +0000 (17:21 -0700)
Summary: Compiled mcrouter with the 'Wpadded' flag to try to find any wasted space. Mcrouter itself did not have anything, but there was a lot in AsyncSocket.h and AsyncSSLSocket.h so looked into those and removed a bit of wasted space

Reviewed By: yfeldblum, brianwatling

Differential Revision: D6033977

fbshipit-source-id: 2dc127208e09980be6a5db576b45d30ac6e044ff

folly/io/async/AsyncSSLSocket.h
folly/io/async/AsyncSocket.h

index 874fb9ddc6d32178774df675658f505ea7c8550c..8de643b82ea3fd346387d13fadee17f7485cd246 100644 (file)
@@ -877,8 +877,6 @@ class AsyncSSLSocket : public virtual AsyncSocket {
   SSL_SESSION *sslSession_{nullptr};
   Timeout handshakeTimeout_;
   Timeout connectionTimeout_;
-  // whether the SSL session was resumed using session ID or not
-  bool sessionIDResumed_{false};
 
   // The app byte num that we are tracking for the MSG_EOR
   // Only one app EOR byte can be tracked.
@@ -918,10 +916,13 @@ class AsyncSSLSocket : public virtual AsyncSocket {
   std::chrono::steady_clock::time_point handshakeStartTime_;
   std::chrono::steady_clock::time_point handshakeEndTime_;
   std::chrono::milliseconds handshakeConnectTimeout_{0};
-  bool sessionResumptionAttempted_{false};
   std::chrono::milliseconds totalConnectTimeout_{0};
 
   std::string sslVerificationAlert_;
+
+  bool sessionResumptionAttempted_{false};
+  // whether the SSL session was resumed using session ID or not
+  bool sessionIDResumed_{false};
 };
 
 } // namespace
index a4c637bbb7e8220431311782e2749ac2f35ce365..35a2149be875a2131ba0ba2420cac9f41f43da96 100644 (file)
@@ -1183,6 +1183,11 @@ class AsyncSocket : virtual public AsyncTransportWrapper {
                                          ///< The address we are connecting from
   uint32_t sendTimeout_;                 ///< The send timeout, in milliseconds
   uint16_t maxReadsPerEvent_;            ///< Max reads per event loop iteration
+
+  bool isBufferMovable_{false};
+
+  int8_t readErr_{READ_NO_ERROR}; ///< The read error encountered, if any
+
   EventBase* eventBase_;                 ///< The EventBase
   WriteTimeout writeTimeout_;            ///< A timeout for connect and write
   IoHandler ioHandler_;                  ///< A EventHandler to monitor the fd
@@ -1198,19 +1203,18 @@ class AsyncSocket : virtual public AsyncTransportWrapper {
   std::weak_ptr<ShutdownSocketSet> wShutdownSocketSet_;
   size_t appBytesReceived_;              ///< Num of bytes received from socket
   size_t appBytesWritten_;               ///< Num of bytes written to socket
-  bool isBufferMovable_{false};
 
   // Pre-received data, to be returned to read callback before any data from the
   // socket.
   std::unique_ptr<IOBuf> preReceivedData_;
 
-  int8_t readErr_{READ_NO_ERROR};        ///< The read error encountered, if any
-
   std::chrono::steady_clock::time_point connectStartTime_;
   std::chrono::steady_clock::time_point connectEndTime_;
 
   std::chrono::milliseconds connectTimeout_{0};
 
+  std::unique_ptr<EvbChangeCallback> evbChangeCb_{nullptr};
+
   BufferCallback* bufferCallback_{nullptr};
   bool tfoEnabled_{false};
   bool tfoAttempted_{false};
@@ -1222,8 +1226,6 @@ class AsyncSocket : virtual public AsyncTransportWrapper {
   bool zeroCopyEnabled_{false};
   bool zeroCopyVal_{false};
   size_t zeroCopyWriteChainThreshold_{kDefaultZeroCopyThreshold};
-
-  std::unique_ptr<EvbChangeCallback> evbChangeCb_{nullptr};
 };
 #ifdef _MSC_VER
 #pragma vtordisp(pop)