Skip to content
Snippets Groups Projects
Unverified Commit 5c69ba73 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

buckets: Don't crash on request for keys before init

This situation is rare, but actually can happen, because the client may
reconnect/restart or join the group before it received the config. Just
warn in such case instead of crashing and ignore the request (the server
will be OK if it doesn't get the answer, it waits for a timeout anyway).
parent f4c62015
No related merge requests found
......@@ -438,7 +438,11 @@ static void communicate(struct context *context, const uint8_t *data, size_t len
}
return;
case 'K': // Send keys
sanity(context->user_data->initialized, "Asked to send keys before initialization\n"); // The server should track who it asks
if (!context->user_data->initialized) {
// This can happen on reconnect, for example, when we lost the config.
ulog(LLOG_WARN, "Asked to send bucket keys before initialization\n");
return;
}
provide_keys(context, data + 1, length - 1);
return;
default:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment