Skip to content

Commit

Permalink
🎨 Use promise<void>
Browse files Browse the repository at this point in the history
  • Loading branch information
Thalhammer committed Apr 30, 2024
1 parent f4669a4 commit b40b43f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/ws-autobahn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ task<int> async_main(int argc, const char** argv) {
websocket socket;
socket.set_on_open([i, ncases](int code) { std::cout << "Test case " << i << "/" << ncases << " ... " << std::flush; });
socket.set_on_message([&socket](websocket::buffer data, bool binary) { socket.send(data, binary, [](bool) {}); });
promise<bool> res;
promise<void> res;
socket.set_on_close([res, main_dp](uint16_t code, std::string_view reason) mutable {
std::cout << "finished (code=" << code << ", reason=\"" << reason << "\")" << std::endl;
main_dp->push([res]() mutable { res.fulfill({}); });
main_dp->push([res]() mutable { res.fulfill(); });
});
socket.connect(uri(base + "/runCase?case=" + std::to_string(i) + "&agent=" + app_name));
co_await res;
Expand Down

0 comments on commit b40b43f

Please sign in to comment.