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

Function parseCount

src/replication.cpp:2475–2496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2473}
2474
2475size_t parseCount(const char *rgch, size_t cch, long long *pvalue) {
2476 size_t cchNumeral = 0;
2477
2478 if (cch > cchNumeral+1 && rgch[cchNumeral+1] == '-') ++cchNumeral;
2479 while ((cch > (cchNumeral+1)) && isdigit(rgch[1 + cchNumeral])) ++cchNumeral;
2480
2481 if (cch < (cchNumeral+1+2)) { // +2 is for the \r\n we expect
2482 throw true; // continuable
2483 }
2484
2485 if (rgch[cchNumeral+1] != '\r' || rgch[cchNumeral+2] != '\n') {
2486 serverLog(LL_WARNING, "Bad protocol from MASTER: %s", rgch);
2487 throw false;
2488 }
2489
2490 if (!string2ll(rgch+1, cchNumeral, pvalue)) {
2491 serverLog(LL_WARNING, "Bad protocol from MASTER: %s", rgch);
2492 throw false;
2493 }
2494
2495 return cchNumeral + 3;
2496}
2497
2498bool readSnapshotBulkPayload(connection *conn, redisMaster *mi, rdbSaveInfo &rsi) {
2499 int fUpdate = g_pserver->fActiveReplica || g_pserver->enable_multimaster;

Callers 1

readSnapshotBulkPayloadFunction · 0.85

Calls 2

serverLogFunction · 0.85
string2llFunction · 0.70

Tested by

no test coverage detected