Skip to content

Commit 7be40c9

Browse files
falucocodebot
authored andcommitted
ru_dummy: move tokens to request handlers instead of creating new ones
1 parent 42ac573 commit 7be40c9

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

lib/ru/dummy/ru_dummy_sector.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ class ru_dummy_sector : public ru_uplink_plane_handler, public ru_downlink_plane
7575

7676
// Set the current slot information.
7777
std::optional<resource_grid_context> late_context =
78-
dl_request[context.slot.system_slot() % dl_request.size()].new_request(
79-
context, grid.copy(), stop_control.get_token());
78+
dl_request[context.slot.system_slot() % dl_request.size()].new_request(context, grid.copy(), std::move(token));
8079
total_dl_request_count.fetch_add(1, std::memory_order_relaxed);
8180

8281
// If the previous slot is valid, it is a late.
@@ -101,7 +100,7 @@ class ru_dummy_sector : public ru_uplink_plane_handler, public ru_downlink_plane
101100

102101
std::optional<prach_buffer_context> late_context =
103102
prach_request[context.slot.system_slot() % prach_request.size()].new_request(
104-
context, &buffer, stop_control.get_token());
103+
context, &buffer, std::move(token));
105104
total_prach_request_count.fetch_add(1, std::memory_order_relaxed);
106105

107106
// Detect if there is an unhandled request from a different slot.
@@ -124,8 +123,7 @@ class ru_dummy_sector : public ru_uplink_plane_handler, public ru_downlink_plane
124123
}
125124

126125
std::optional<resource_grid_context> late_context =
127-
ul_request[context.slot.system_slot() % ul_request.size()].new_request(
128-
context, grid.copy(), stop_control.get_token());
126+
ul_request[context.slot.system_slot() % ul_request.size()].new_request(context, grid.copy(), std::move(token));
129127
total_ul_request_count.fetch_add(1, std::memory_order_relaxed);
130128

131129
// Detect if there is an unhandled request from a different slot.
@@ -291,9 +289,6 @@ class ru_dummy_sector : public ru_uplink_plane_handler, public ru_downlink_plane
291289
// Transition to available. The object will become available again.
292290
internal_state.store(internal_states::available);
293291

294-
// Reset the stop token.
295-
local_token.reset();
296-
297292
// Return the context and resource.
298293
return {current_context, std::move(current_resource)};
299294
}

0 commit comments

Comments
 (0)