Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Commit

Permalink
tests pass...
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelsavannah committed Apr 23, 2019
1 parent 45f7f42 commit a45ef3e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
7 changes: 4 additions & 3 deletions node/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,6 @@ session::do_read()
return;
}

self->reading = false;
self->do_read();

self->io_context->post(
[self, buffer]()
{
Expand All @@ -218,6 +215,10 @@ session::do_read()
LOG(error) << "Failed to parse incoming message";
}
});

self->reading = false;
self->do_read();

})
);
}
Expand Down
2 changes: 2 additions & 0 deletions node/test/node_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ namespace bzn
callback_execute++;
});

EXPECT_CALL(*mock_io_context, post(_)).WillRepeatedly(Invoke([](auto handler){handler();}));

bzn_envelope bad_msg;
bad_msg.set_pbft("some stuff");
bad_msg.set_sender("Elizabeth the Second, by the Grace of God of the United Kingdom, Canada and Her other Realms and Territories Queen, Head of the Commonwealth, Defender of the Faith");
Expand Down
2 changes: 1 addition & 1 deletion node/test/node_test_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace bzn
EXPECT_CALL(*(this->io_context), post(_)).WillRepeatedly(Invoke(
[&](auto func)
{
this->real_io_context->post(func);
func();
}));

EXPECT_CALL(*(this->io_context), make_unique_steady_timer()).WillRepeatedly(Invoke(
Expand Down
3 changes: 3 additions & 0 deletions node/test/session_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class session_test : public Test
EXPECT_CALL(*strand, wrap(A<bzn::asio::task>())).WillRepeatedly(ReturnArg<0>());
return strand;
}));

EXPECT_CALL(*(this->io_context), post(_)).WillRepeatedly(Invoke([](auto handler){handler();}));
}
};

Expand Down Expand Up @@ -164,6 +166,7 @@ namespace bzn
.io_context
->make_unique_tcp_socket()
->get_tcp_socket()));

this->mock.ws_accept_handlers.at(0)(boost::system::error_code{});

this->mock.timer_callbacks.at(0)(boost::system::error_code{});
Expand Down

0 comments on commit a45ef3e

Please sign in to comment.