Avoid the master to detect the replica is timing out while loading the * RDB file in initial synchronization. We send a single newline character * that is valid protocol but is guaranteed to either be sent entirely or * not, since the byte is indivisible. * * The function is called in two contexts: while we flush the current * data with emptyDb(), and while we load the new data received as a
| 2316 | * data with emptyDb(), and while we load the new data received as an |
| 2317 | * RDB file from the master. */ |
| 2318 | void replicationSendNewlineToMaster(redisMaster *mi) { |
| 2319 | static time_t newline_sent; |
| 2320 | if (time(NULL) != newline_sent) { |
| 2321 | newline_sent = time(NULL); |
| 2322 | /* Pinging back in this stage is best-effort. */ |
| 2323 | if (mi->repl_transfer_s) connWrite(mi->repl_transfer_s, "\n", 1); |
| 2324 | } |
| 2325 | } |
| 2326 | |
| 2327 | /* Callback used by emptyDb() while flushing away old data to load |
| 2328 | * the new dataset received by the master. */ |
no test coverage detected