diff --git a/src/replication.c b/src/replication.c index 13a1927a..a1e32b55 100644 --- a/src/replication.c +++ b/src/replication.c @@ -376,6 +376,12 @@ void syncWithMaster(aeEventLoop *el, int fd, void *privdata, int mask) { REDIS_NOTUSED(privdata); REDIS_NOTUSED(mask); + redisLog(REDIS_NOTICE,"Non blocking connect for SYNC fired the event."); + /* This event should only be triggered once since it is used to have a + * non-blocking connect(2) to the master. It has been triggered when this + * function is called, so we can delete it. */ + aeDeleteFileEvent(server.el,fd,AE_READABLE|AE_WRITABLE); + /* If this event fired after the user turned the instance into a master * with SLAVEOF NO ONE we must just return ASAP. */ if (server.replstate == REDIS_REPL_NONE) { @@ -383,12 +389,6 @@ void syncWithMaster(aeEventLoop *el, int fd, void *privdata, int mask) { return; } - redisLog(REDIS_NOTICE,"Non blocking connect for SYNC fired the event."); - /* This event should only be triggered once since it is used to have a - * non-blocking connect(2) to the master. It has been triggered when this - * function is called, so we can delete it. */ - aeDeleteFileEvent(server.el,fd,AE_READABLE|AE_WRITABLE); - /* AUTH with the master if required. */ if(server.masterauth) { char authcmd[1024];