Skip to content

Commit

Permalink
[modesetting] Clear timer id when network_retry timer is triggered
Browse files Browse the repository at this point in the history
When network_retry() timer callback gets triggered, the associated
timer id delayed_network is not invalidated and usb moded can try
to remove it later on - which will lead to complaints from glib
being emitted to journal.

Clear the timer id when the timer callback gets called.

Also make sure already existing timer id is not left active when
scheduling a timeout.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Jul 7, 2016
1 parent 23ea040 commit 839fda6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/usb_moded-modesetting.c
Expand Up @@ -43,7 +43,7 @@
#include "usb_moded-android.h"

static void report_mass_storage_blocker(const char *mountpoint, int try);
guint delayed_network = 0;
static guint delayed_network = 0;

int write_to_file(const char *path, const char *text)
{
Expand Down Expand Up @@ -88,6 +88,7 @@ int write_to_file(const char *path, const char *text)

static gboolean network_retry(gpointer data)
{
delayed_network = 0;
usb_network_up(data);
return(FALSE);
}
Expand Down Expand Up @@ -399,6 +400,8 @@ int set_dynamic_mode(void)
if(network != 0 && data->network)
{
log_debug("Retry setting up the network later\n");
if(delayed_network)
g_source_remove(delayed_network);
delayed_network = g_timeout_add_seconds(3, network_retry, data);
}

Expand Down

0 comments on commit 839fda6

Please sign in to comment.