Add the specified client id / timeout as a key in the radix tree we use * to handle blocked clients timeouts. The client is not added to the list * if its timeout is zero (block forever). */
| 113 | * to handle blocked clients timeouts. The client is not added to the list |
| 114 | * if its timeout is zero (block forever). */ |
| 115 | void addClientToTimeoutTable(client *c) { |
| 116 | if (c->bpop.timeout == 0) return; |
| 117 | uint64_t timeout = c->bpop.timeout; |
| 118 | unsigned char buf[CLIENT_ST_KEYLEN]; |
| 119 | encodeTimeoutKey(buf,timeout,c); |
| 120 | if (raxTryInsert(g_pserver->clients_timeout_table,buf,sizeof(buf),NULL,NULL)) |
| 121 | c->flags |= CLIENT_IN_TO_TABLE; |
| 122 | } |
| 123 | |
| 124 | /* Remove the client from the table when it is unblocked for reasons |
| 125 | * different than timing out. */ |
no test coverage detected