MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / encodeTimeoutKey

Function encodeTimeoutKey

src/timeout.cpp:97–102  ·  view source on GitHub ↗

Given client ID and timeout, write the resulting radix tree key in buf. */

Source from the content-addressed store, hash-verified

95
96/* Given client ID and timeout, write the resulting radix tree key in buf. */
97void encodeTimeoutKey(unsigned char *buf, uint64_t timeout, client *c) {
98 timeout = htonu64(timeout);
99 memcpy(buf,&timeout,sizeof(timeout));
100 memcpy(buf+8,&c,sizeof(c));
101 if (sizeof(c) == 4) memset(buf+12,0,4); /* Zero padding for 32bit target. */
102}
103
104/* Given a key encoded with encodeTimeoutKey(), resolve the fields and write
105 * the timeout into *toptr and the client pointer into *cptr. */

Callers 2

addClientToTimeoutTableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected