gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

statemachine fixes (patch)


From: Osma Suominen
Subject: statemachine fixes (patch)
Date: Sun, 16 Feb 2003 17:37:02 +0200 (EET)

Hi,

while browsing through statemachine code I found some strange things.
There are two things this patch does:

1. remove a line that seems totally unnecessary - it checks the
   state variable s, which on the first loop iteration is unset, and
   on the following iterations the condition is always false, because
   of a similar line that appears after setting s
2. allow sm_block and friends to be used not only directly after
   sm_message_send but also with sm_reset in between, which sets the
   state to GN_SM_Initialised

If you disagree with my logic, just disregard this. Issue 2 is the
reason (well, part of it) why the 3110 code often segfaults on
getsms. It didn't happen before the recent statemachine fixes.

-Osma

diff -u -r1.41 gsm-statemachine.c
--- gsm-statemachine.c  12 Feb 2003 19:08:07 -0000      1.41
+++ gsm-statemachine.c  16 Feb 2003 15:28:44 -0000
@@ -228,13 +228,11 @@
                err = sm_wait_for(waitfor, data, state);
                if (err != GN_ERR_NONE) return err;

-               if (s == GN_SM_WaitingForResponse || s == 
GN_SM_ResponseReceived) break;
-
                timeradd(&now, &timeout, &next);
                do {
                        s = gn_sm_loop(1, state);  /* Timeout=100ms */
                        gettimeofday(&now, NULL);
-               } while (timercmp(&next, &now, >) && (s == GN_SM_MessageSent));
+               } while (timercmp(&next, &now, >) && (s == GN_SM_Initialised || 
s == GN_SM_MessageSent));

                if (s == GN_SM_WaitingForResponse || s == 
GN_SM_ResponseReceived) break;


-- 
*** Osma Suominen *** address@hidden *** http://www.iki.fi/ozone/ ***




reply via email to

[Prev in Thread] Current Thread [Next in Thread]