Skip to content

Commit

Permalink
Move repl_rdb_channel_state check to abortDualChannelSync
Browse files Browse the repository at this point in the history
Signed-off-by: naglera <[email protected]>
  • Loading branch information
naglera committed Jul 24, 2024
1 parent 3ee2d73 commit fc2465d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/replication.c
Original file line number Diff line number Diff line change
Expand Up @@ -2514,7 +2514,7 @@ void freePendingReplDataBuf(void) {
* Upon dual-channel sync failure, close rdb-connection, reset repl-state, reset
* provisional primary struct, and free local replication buffer. */
void replicationAbortDualChannelSyncTransfer(void) {
serverAssert(server.repl_rdb_channel_state != REPL_DUAL_CHANNEL_STATE_NONE);
if(server.repl_rdb_channel_state != REPL_DUAL_CHANNEL_STATE_NONE) return;
serverLog(LL_NOTICE, "Aborting dual channel sync");
if (server.repl_rdb_transfer_s) {
connClose(server.repl_rdb_transfer_s);
Expand Down Expand Up @@ -3688,9 +3688,7 @@ void replicationAbortSyncTransfer(void) {
*
* Otherwise zero is returned and no operation is performed at all. */
int cancelReplicationHandshake(int reconnect) {
if (server.repl_rdb_channel_state != REPL_DUAL_CHANNEL_STATE_NONE) {
replicationAbortDualChannelSyncTransfer();
}
replicationAbortDualChannelSyncTransfer();
if (server.repl_state == REPL_STATE_TRANSFER) {
replicationAbortSyncTransfer();
server.repl_state = REPL_STATE_CONNECT;
Expand Down

0 comments on commit fc2465d

Please sign in to comment.