diff --git a/src/BackgroundThread.cpp b/src/BackgroundThread.cpp index 42706be..322929e 100644 --- a/src/BackgroundThread.cpp +++ b/src/BackgroundThread.cpp @@ -42,6 +42,5 @@ BOOL BackgroundThread::whileLoop() { OSSleepTicks(OSSecondsToTicks(5)); } } - OSSleepTicks(OSMillisecondsToTicks(1)); return true; } diff --git a/src/ftp.c b/src/ftp.c index db5f8da..5867c2e 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -958,9 +958,11 @@ recv_loop_end: bool process_ftp_events(int32_t server) { bool network_down = !process_accept_events(server); int client_index; + bool hasActiveClients = false; for (client_index = 0; client_index < MAX_CLIENTS; client_index++) { client_t *client = clients[client_index]; if (client) { + hasActiveClients = true; if (client->data_callback) { process_data_events(client); } else { @@ -968,5 +970,10 @@ bool process_ftp_events(int32_t server) { } } } + if (!hasActiveClients) { + OSSleepTicks(OSMillisecondsToTicks(100)); + } else { + OSSleepTicks(OSMillisecondsToTicks(1)); + } return network_down; }