Skip to content

Commit 17c426b

Browse files
authored
Merge pull request #14 from JoyStream/development
dev to master - v0.1.2
2 parents d3f4edc + 5bdd279 commit 17c426b

5 files changed

Lines changed: 16 additions & 5 deletions

File tree

conan_package/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class ProtocolSessionBase(ConanFile):
55
name = "ProtocolSession"
6-
version = "0.1.1"
6+
version = "0.1.2"
77
license = "(c) JoyStream Inc. 2016-2017"
88
url = "https://github.com/JoyStream/protocol_session-conan.git"
99
git_repo = "git@github.com:JoyStream/protocol_session-cpp.git"

sources/include/protocol_session/detail/Buying.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ namespace detail {
350350

351351
// Check if seller has timed out in servicing the current request,
352352
// if so remove connection
353-
if(s.servicingPieceHasTimedOut(std::chrono::seconds(5))) // <== hard coded for now, logic will be factored out later! see PR on this
353+
if(s.servicingPieceHasTimedOut(std::chrono::seconds(20))) // <== hard coded for now, logic will be factored out later! see PR on this
354354
removeConnection(id, DisconnectCause::seller_servicing_piece_has_timed_out);
355355
}
356356
}

sources/test/SessionTest.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ void SessionTest::takeSingleSellerToExchange(SellerPeer & peer) {
527527
PeerToStartDownloadInformationMap<ID> map = downloadInformationMap(v);
528528

529529
// Start download
530-
session->startDownloading(contractTx, map);
530+
session->startDownloading(contractTx, map, nextPiecePicker);
531531

532532
// make sure contract was announced to only relevant peers
533533
peer.contractAnnounced();
@@ -549,3 +549,12 @@ void SessionTest::assertSellerInvited(const SellerPeer & peer) {
549549
EXPECT_EQ(m2.index(), peer.sellerTermsIndex);
550550

551551
}
552+
553+
554+
int SessionTest::nextPiecePicker(const std::vector<detail::Piece<ID>>* pieces) {
555+
for(uint32_t i = 0;i < pieces->size();i++)
556+
if(pieces->at(i).state() == PieceState::unassigned)
557+
return i;
558+
559+
throw exception::NoPieceAvailableException();
560+
}

sources/test/SessionTest.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class SessionTest : public ::testing::Test {
159159
return joiningContract;
160160
}
161161

162-
void contractAnnounced() {
162+
void contractAnnounced() {
163163
auto slot = spy->sendReadyCallbackSlot;
164164
EXPECT_TRUE((int)slot.size() > 0);
165165
ready = std::get<0>(slot.front());
@@ -233,6 +233,8 @@ class SessionTest : public ::testing::Test {
233233
bool hasPendingFullPieceRequest(const std::vector<SellerPeer> &);
234234
void takeSingleSellerToExchange(SellerPeer &);
235235
void assertSellerInvited(const SellerPeer &);
236+
237+
static int nextPiecePicker(const std::vector<detail::Piece<ID>>* pieces);
236238
};
237239

238240
#endif // TEST_HPP

sources/test/test_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ TEST_F(SessionTest, buying)
485485
PeerToStartDownloadInformationMap<ID> map = downloadInformationMap(v);
486486

487487
// Start download
488-
session->startDownloading(contractTx, map);
488+
session->startDownloading(contractTx, map, SessionTest::nextPiecePicker);
489489

490490
// make sure contract was announced to only relevant peers
491491
first.contractAnnounced();

0 commit comments

Comments
 (0)