fix possible endless loops (100% CPU) in networking code

This commit is contained in:
Thomas Schoebel-Theuer 2011-10-18 09:01:52 +02:00 committed by Thomas Schoebel-Theuer
parent fe9a5cb155
commit 6bad7eca8d
2 changed files with 6 additions and 3 deletions

View File

@ -418,7 +418,7 @@ static int server_switch(struct server_brick *brick)
mars_power_led_off((void*)brick, false);
MARS_INF("starting.....");
MARS_INF("starting.....\n");
spin_lock(&server_lock);
list_add(&brick->server_link, &server_list);
@ -566,7 +566,7 @@ static int _server_thread(void *data)
MARS_INF("-------- server starting on host '%s' ----------\n", id);
while (!kthread_should_stop()) {
while (!kthread_should_stop() && mars_global && mars_global->global_power.button) {
struct server_brick *brick;
struct mars_socket *new_socket;
@ -607,6 +607,7 @@ static int _server_thread(void *data)
goto err;
}
msleep(1000);
continue;
err:

View File

@ -928,6 +928,7 @@ int remote_thread(void *data)
continue;
}
MARS_DBG("successfully opened socket to '%s'\n", real_peer);
msleep(1000);
continue;
}
@ -962,8 +963,9 @@ int remote_thread(void *data)
mars_free_dent_all(NULL, &old_list);
msleep(1000);
if (!kthread_should_stop())
msleep(5 * 1000);
msleep(4000);
}
MARS_INF("-------- remote thread terminating\n");