diff --git a/toREST/include/ws.hpp b/toREST/include/ws.hpp index 5318017..cf72b64 100644 --- a/toREST/include/ws.hpp +++ b/toREST/include/ws.hpp @@ -24,9 +24,7 @@ void on_close(Session &session, Connection con, int status, const std::string &r template void on_open(Server &server, Session &session, Connection con) { - if (session.is_valid()) { - session.post_torrent_updates(); - } else { + if (!session.is_valid()) { server.send_close(con, status::unexpected, "Session not valid"); } } diff --git a/toREST/tests/ws_test.cpp b/toREST/tests/ws_test.cpp index ac69cab..5720307 100644 --- a/toREST/tests/ws_test.cpp +++ b/toREST/tests/ws_test.cpp @@ -35,8 +35,8 @@ SCENARIO("we have a websocket resource") { session.valid = true; WHEN("we open the connection") { tr::ws::on_open(server, session, connection); - THEN("the session should post torrent torrent updates") { - REQUIRE(session.post_torrent_updates_calls_ == 1); + THEN("the session should not post torrent torrent updates") { + REQUIRE(server.send_close_calls_ == 0); } } }