Skip to content

Commit e700da8

Browse files
committed
Removed lock/unlock on config for master updates
At this point is it more for ease than anything else. The locks could be released quickly with some effort.
1 parent 9102379 commit e700da8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/slave.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,6 @@ static int update_from_master(master_server *master)
625625
if (master->password == NULL || master->server == NULL || master->port == 0)
626626
break;
627627
ret = 1;
628-
config_release_config();
629628
mastersock = sock_connect_wto(master->server, master->port, 10);
630629

631630
if (mastersock == SOCK_ERROR)
@@ -782,16 +781,17 @@ static void *_slave_thread(void *arg)
782781
max_interval = config->master_update_interval;
783782
thread_mutex_unlock(&_slave_mutex);
784783

785-
/* update all non-legacy master servers */
784+
/* update all non-legacy master servers. the config lock is being
785+
* held for the entire update process. consider making a copy of
786+
* the master linked list and releasing the lock */
786787
master = config->master;
787788
while (master) {
788789
update_from_master(master);
789790
master = master->next;
790791
}
791792

792-
/* the connection could take some time, so the lock can drop */
793-
if (update_from_master_legacy (config))
794-
config = config_get_config();
793+
/* update legacy master server */
794+
update_from_master_legacy (config);
795795

796796
thread_mutex_lock (&(config_locks()->relay_lock));
797797

0 commit comments

Comments
 (0)