Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix client trackinginfo crash when tracking off by default #1684

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -4100,7 +4100,7 @@ void clientTrackingInfoCommand(client *c) {

/* Prefixes */
addReplyBulkCString(c, "prefixes");
if (c->pubsub_data->client_tracking_prefixes) {
if (c->flag.tracking && c->pubsub_data->client_tracking_prefixes) {
addReplyArrayLen(c, raxSize(c->pubsub_data->client_tracking_prefixes));
raxIterator ri;
raxStart(&ri, c->pubsub_data->client_tracking_prefixes);
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/tracking.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,16 @@ start_server {tags {"tracking network logreqres:skip"}} {
# Just some extra coverage for --log-req-res, because we do not
# run the full tracking unit in that mode
start_server {tags {"tracking network"}} {
test {CLIENT TRACKINGINFO when start} {
set res [r client trackinginfo]
set flags [dict get $res flags]
assert_equal {off} $flags
set redirect [dict get $res redirect]
assert_equal {-1} $redirect
set prefixes [dict get $res prefixes]
assert_equal {} $prefixes
}

test {Coverage: Basic CLIENT CACHING} {
set rd_redirection [valkey_deferring_client]
$rd_redirection client id
Expand Down
Loading