diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-03-26 17:12:52 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-03-26 17:20:27 +0900 |
| commit | d64089632e82a2548752c7a6baaa68365a795a74 (patch) | |
| tree | 57fc7b85a8c1290975d58fa4761b04a7695bf7e3 /src/RequestSlot.h | |
| parent | c81b1321122e8509b55c94c0cbca0d8d6d319f0c (diff) | |
| parent | a7cd943a06b1a5ff4515b57060b84037f8d01f9f (diff) | |
Merge branch 'master' into random-webseeding
Diffstat (limited to 'src/RequestSlot.h')
| -rw-r--r-- | src/RequestSlot.h | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/src/RequestSlot.h b/src/RequestSlot.h index 2e019631..fb9ade4a 100644 --- a/src/RequestSlot.h +++ b/src/RequestSlot.h @@ -46,23 +46,28 @@ class RequestSlot { public: RequestSlot(size_t index, int32_t begin, int32_t length, size_t blockIndex, std::shared_ptr<Piece> piece = nullptr) - : dispatchedTime_(global::wallclock()), - index_(index), begin_(begin), length_(length), blockIndex_(blockIndex), - piece_(std::move(piece)) - {} + : dispatchedTime_(global::wallclock()), + index_(index), + begin_(begin), + length_(length), + blockIndex_(blockIndex), + piece_(std::move(piece)) + { + } RequestSlot() - : dispatchedTime_(Timer::zero()), - index_(0), - begin_(0), - length_(0), - blockIndex_(0) - {} + : dispatchedTime_(Timer::zero()), + index_(0), + begin_(0), + length_(0), + blockIndex_(0) + { + } bool operator==(const RequestSlot& requestSlot) const { - return index_ == requestSlot.index_ && begin_ == requestSlot.begin_ - && length_ == requestSlot.length_; + return index_ == requestSlot.index_ && begin_ == requestSlot.begin_ && + length_ == requestSlot.length_; } bool operator!=(const RequestSlot& requestSlot) const @@ -72,9 +77,10 @@ public: bool operator<(const RequestSlot& requestSlot) const { - if(index_ == requestSlot.index_) { + if (index_ == requestSlot.index_) { return begin_ < requestSlot.begin_; - } else { + } + else { return index_ < requestSlot.index_; } } @@ -93,10 +99,7 @@ public: size_t getBlockIndex() const { return blockIndex_; } void setBlockIndex(size_t blockIndex) { blockIndex_ = blockIndex; } - const std::shared_ptr<Piece>& getPiece() const - { - return piece_; - } + const std::shared_ptr<Piece>& getPiece() const { return piece_; } // For unit test void setDispatchedTime(Timer t) { dispatchedTime_ = std::move(t); } |
