Skip to contentSkip to conversation

plugins-mbm: Remove data->reopen_source timer before setting up new one

PATCH In review Tomasz Gregorek 2 participants 2 messages Jan 14, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 plugins-mbm: Remove data->reopen_source timer before setting up new one

From: Tomasz Gregorek <[email protected]>

Check if there is a timer running already and remove it before creating a new one. This will prevent calling reopen_callback() more than if mbm_disconnect() is called more than once.

---
 plugins/mbm.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
plugins/mbm.c +3 -0
index 38583ac..4048f6a 100644
@@ -351,6 +351,9 @@ static void mbm_disconnect(gpointer user_data)
 	data->data_port = NULL;
 
 	/* Waiting for the +CGEV: ME DEACT might also work */
+	if (data->reopen_source > 0)
+		g_source_remove(data->reopen_source);
+
 	data->reopen_source = g_timeout_add_seconds(1, reopen_callback, modem);
 }
 
Signature · 1 line
1.7.1
#1 lore raw

Hi Tomasz,

Quoted 6 lines

Check if there is a timer running already and remove it before creating a new one. This will prevent calling reopen_callback() more than if mbm_disconnect() is called more than once.

---
 plugins/mbm.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

patch has been applied, but same comment about the prefix applies here as well.

Regards

Marcel