Skip to content

Commit d95aa8d

Browse files
authored
Fix invalid notify check on response rather than request (#1430)
1 parent 46ffea1 commit d95aa8d

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

include/glaze/ext/glaze_asio.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ namespace glz
508508
while (true) {
509509
co_await co_receive_buffer(socket, request);
510510
registry.call(request, response);
511-
if (not response.header.notify()) {
511+
if (not request.header.notify()) {
512512
co_await co_send_buffer(socket, response);
513513
}
514514
}

include/glaze/rpc/repe/header.hpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -47,30 +47,30 @@ namespace glz::repe
4747
void notify(bool enable)
4848
{
4949
if (enable) {
50-
action = static_cast<repe::action>(uint32_t(action) | uint32_t(action::notify));
50+
action = static_cast<repe::action>(uint32_t(action) | uint32_t(repe::action::notify));
5151
}
5252
else {
53-
action = static_cast<repe::action>(uint32_t(action) & ~uint32_t(action::notify));
53+
action = static_cast<repe::action>(uint32_t(action) & ~uint32_t(repe::action::notify));
5454
}
5555
}
5656

5757
void read(bool enable)
5858
{
5959
if (enable) {
60-
action = static_cast<repe::action>(uint32_t(action) | uint32_t(action::read));
60+
action = static_cast<repe::action>(uint32_t(action) | uint32_t(repe::action::read));
6161
}
6262
else {
63-
action = static_cast<repe::action>(uint32_t(action) & ~uint32_t(action::read));
63+
action = static_cast<repe::action>(uint32_t(action) & ~uint32_t(repe::action::read));
6464
}
6565
}
6666

6767
void write(bool enable)
6868
{
6969
if (enable) {
70-
action = static_cast<repe::action>(uint32_t(action) | uint32_t(action::write));
70+
action = static_cast<repe::action>(uint32_t(action) | uint32_t(repe::action::write));
7171
}
7272
else {
73-
action = static_cast<repe::action>(uint32_t(action) & ~uint32_t(action::write));
73+
action = static_cast<repe::action>(uint32_t(action) & ~uint32_t(repe::action::write));
7474
}
7575
}
7676
};

tests/repe_test/repe_test.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ struct example_functions_t
6363
};
6464
};
6565

66+
suite header_tests = [] {
67+
"header"_test = [] {
68+
glz::repe::header h{.action = glz::repe::action::read};
69+
expect(not h.notify());
70+
expect(h.read());
71+
};
72+
};
73+
6674
suite structs_of_functions = [] {
6775
"structs_of_functions"_test = [] {
6876
repe::registry server{};

0 commit comments

Comments
 (0)