Make sure replicationSetMaster() works when ip argument is not an sds.

This commit is contained in:
antirez 2013-03-04 15:39:43 +01:00
parent b8a28bf442
commit 3be893123f

View File

@ -1229,7 +1229,7 @@ int cancelReplicationHandshake(void) {
/* Set replication to the specified master address and port. */ /* Set replication to the specified master address and port. */
void replicationSetMaster(char *ip, int port) { void replicationSetMaster(char *ip, int port) {
sdsfree(server.masterhost); sdsfree(server.masterhost);
server.masterhost = sdsdup(ip); server.masterhost = sdsnew(ip);
server.masterport = port; server.masterport = port;
if (server.master) freeClient(server.master); if (server.master) freeClient(server.master);
disconnectSlaves(); /* Force our slaves to resync with us as well. */ disconnectSlaves(); /* Force our slaves to resync with us as well. */