| 2535 | } |
| 2536 | |
| 2537 | int connectWithMaster(void) { |
| 2538 | server.repl_transfer_s = server.tls_replication ? connCreateTLS() : connCreateSocket(); |
| 2539 | if (connConnect(server.repl_transfer_s, server.masterhost, server.masterport, |
| 2540 | NET_FIRST_BIND_ADDR, syncWithMaster) == C_ERR) { |
| 2541 | serverLog(LL_WARNING,"Unable to connect to MASTER: %s", |
| 2542 | connGetLastError(server.repl_transfer_s)); |
| 2543 | connClose(server.repl_transfer_s); |
| 2544 | server.repl_transfer_s = NULL; |
| 2545 | return C_ERR; |
| 2546 | } |
| 2547 | |
| 2548 | |
| 2549 | server.repl_transfer_lastio = server.unixtime; |
| 2550 | server.repl_state = REPL_STATE_CONNECTING; |
| 2551 | serverLog(LL_NOTICE,"MASTER <-> REPLICA sync started"); |
| 2552 | return C_OK; |
| 2553 | } |
| 2554 | |
| 2555 | /* This function can be called when a non blocking connection is currently |
| 2556 | * in progress to undo it. |
no test coverage detected