瀏覽代碼

Moved bool members to the last to reduce structure size

Tatsuhiro Tsujikawa 13 年之前
父節點
當前提交
71620854c7
共有 2 個文件被更改,包括 19 次插入19 次删除
  1. 5 5
      src/PeerSessionResource.cc
  2. 14 14
      src/PeerSessionResource.h

+ 5 - 5
src/PeerSessionResource.cc

@@ -46,6 +46,10 @@ namespace aria2 {
 
 PeerSessionResource::PeerSessionResource(int32_t pieceLength, int64_t totalLength)
   :
+  bitfieldMan_(new BitfieldMan(pieceLength, totalLength)),
+  lastDownloadUpdate_(0),
+  lastAmUnchoking_(0),
+  dispatcher_(0),
   amChoking_(true),
   amInterested_(false),
   peerChoking_(true),
@@ -53,13 +57,9 @@ PeerSessionResource::PeerSessionResource(int32_t pieceLength, int64_t totalLengt
   chokingRequired_(true),
   optUnchoking_(false),
   snubbing_(false),
-  bitfieldMan_(new BitfieldMan(pieceLength, totalLength)),
   fastExtensionEnabled_(false),
   extendedMessagingEnabled_(false),
-  dhtEnabled_(false),
-  lastDownloadUpdate_(0),
-  lastAmUnchoking_(0),
-  dispatcher_(0)
+  dhtEnabled_(false)
 {}
 
 PeerSessionResource::~PeerSessionResource()

+ 14 - 14
src/PeerSessionResource.h

@@ -52,6 +52,20 @@ class BtMessageDispatcher;
 
 class PeerSessionResource {
 private:
+  BitfieldMan* bitfieldMan_;
+  // fast index set which a peer has sent to localhost.
+  std::set<size_t> peerAllowedIndexSet_;
+  // fast index set which localhost has sent to a peer.
+  std::set<size_t> amAllowedIndexSet_;
+  ExtensionMessageRegistry extreg_;
+  PeerStat peerStat_;
+
+  Timer lastDownloadUpdate_;
+
+  Timer lastAmUnchoking_;
+
+  BtMessageDispatcher* dispatcher_;
+
   // localhost is choking this peer
   bool amChoking_;
   // localhost is interested in this peer
@@ -66,23 +80,9 @@ private:
   bool optUnchoking_;
   // this peer is snubbing.
   bool snubbing_;
-
-  BitfieldMan* bitfieldMan_;
   bool fastExtensionEnabled_;
-  // fast index set which a peer has sent to localhost.
-  std::set<size_t> peerAllowedIndexSet_;
-  // fast index set which localhost has sent to a peer.
-  std::set<size_t> amAllowedIndexSet_;
   bool extendedMessagingEnabled_;
-  ExtensionMessageRegistry extreg_;
   bool dhtEnabled_;
-  PeerStat peerStat_;
-
-  Timer lastDownloadUpdate_;
-
-  Timer lastAmUnchoking_;
-
-  BtMessageDispatcher* dispatcher_;
 public:
   PeerSessionResource(int32_t pieceLength, int64_t totalLength);