| 2473 | } |
| 2474 | |
| 2475 | size_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 | |
| 2498 | bool readSnapshotBulkPayload(connection *conn, redisMaster *mi, rdbSaveInfo &rsi) { |
| 2499 | int fUpdate = g_pserver->fActiveReplica || g_pserver->enable_multimaster; |
no test coverage detected