File tree Expand file tree Collapse file tree
include/protocol_session/detail Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44class 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"
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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+ }
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 ();
You can’t perform that action at this time.
0 commit comments