MCPcopy Create free account
hub / github.com/antirez/ds4 / dist_session_token_hash_prefix

Function dist_session_token_hash_prefix

ds4_distributed.c:1513–1526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1511}
1512
1513static int dist_session_token_hash_prefix(
1514 ds4_session *session,
1515 uint32_t n_tokens,
1516 uint64_t *hash,
1517 char *err,
1518 size_t errlen) {
1519 const ds4_tokens *checkpoint = ds4_session_tokens(session);
1520 if (!hash || !checkpoint || checkpoint->len < 0 || (uint32_t)checkpoint->len < n_tokens) {
1521 if (errlen) snprintf(err, errlen, "distributed session has no %u-token prefix", n_tokens);
1522 return 1;
1523 }
1524 *hash = dist_token_hash_prefix(checkpoint->v, n_tokens);
1525 return 0;
1526}
1527
1528static bool dist_bytes_have_nul(const void *p, uint32_t len) {
1529 return len != 0 && memchr(p, '\0', len) != NULL;

Callers 1

Calls 2

ds4_session_tokensFunction · 0.85
dist_token_hash_prefixFunction · 0.85

Tested by

no test coverage detected