MCPcopy Create free account
hub / github.com/F-Stack/f-stack / connectWithMaster

Function connectWithMaster

app/redis-6.2.6/src/replication.c:2537–2553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2535}
2536
2537int 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.

Callers 4

replicationSetMasterFunction · 0.85
replicationCronFunction · 0.85

Calls 5

connCreateTLSFunction · 0.85
connCreateSocketFunction · 0.85
connConnectFunction · 0.85
connGetLastErrorFunction · 0.85
connCloseFunction · 0.85

Tested by

no test coverage detected