gnokii-commit
[Top][All Lists]
Advanced

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

[SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-15


From: Pawel Kot
Subject: [SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-153-g7693ab5
Date: Sun, 30 Jan 2011 12:25:56 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "libgnokii and core programs".

The branch, master has been updated
       via  7693ab59e577a093ac3da47ed21529723ed7f0b7 (commit)
      from  ad3ffd0c9213566a1cdad2009d848ea1851e3399 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnokii.git/commit/?id=7693ab59e577a093ac3da47ed21529723ed7f0b7


commit 7693ab59e577a093ac3da47ed21529723ed7f0b7
Author: Pawel Kot <address@hidden>
Date:   Sun Jan 30 13:25:49 2011 +0100

    Optimize the phonet overrun handling
    
    Optimize the phonet overrun case as suggested by Daniele Forsi:
     - handle it only once permessage in FBUS_RX_GetLength2
     - when we cannot allocate memory, let's not skip it over completely, but 
print out the message to the debug log

diff --git a/common/links/fbus-phonet.c b/common/links/fbus-phonet.c
index 2814bff..1c82a7c 100644
--- a/common/links/fbus-phonet.c
+++ b/common/links/fbus-phonet.c
@@ -143,6 +143,7 @@ static void phonet_rx_statemachine(unsigned char rx_byte, 
struct gn_statemachine
                    rx_byte == FBUS_PHONET_DKU2_FRAME_ID) {
                        i->state = FBUS_RX_GetDestination;
                }
+               i->message_corrupted = 0;
                break;
 
        case FBUS_RX_GetDestination:
@@ -184,16 +185,25 @@ static void phonet_rx_statemachine(unsigned char rx_byte, 
struct gn_statemachine
                i->message_length = i->message_length + rx_byte;
                i->state = FBUS_RX_GetMessage;
                i->buffer_count = 0;
-               break;
-
-       case FBUS_RX_GetMessage:
                if (!verify_max_message_len(i->message_length, 
&(i->message_buffer))) {
                        dprintf("PHONET: Failed to allocate memory for larger 
buffer\n");
                        dprintf("PHONET: Message buffer overrun - resetting 
(message length: %d, max: %d)\n", i->message_length, PHONET_FRAME_MAX_LENGTH);
-                       dprintf("PHONET: Resetting\n");
-                       i->state = FBUS_RX_Sync;
-                       break;
+                       i->message_corrupted = 1;
                }
+               break;
+
+       case FBUS_RX_GetMessage:
+               /*
+                * If message is corrupted it means that we couldn't allocate 
full
+                * space to store it. Therefore let's just print out the 
message.
+                */
+               if (i->message_corrupted) {
+                       if (i->buffer_count % 16 == 0)
+                               dprintf("\n");
+                       dprintf("%02x ", rx_byte);
+                       i->buffer_count++;
+               }
+
                i->message_buffer[i->buffer_count] = rx_byte;
                i->buffer_count++;
 
diff --git a/include/links/fbus-phonet.h b/include/links/fbus-phonet.h
index 33e06b3..2c0deeb 100644
--- a/include/links/fbus-phonet.h
+++ b/include/links/fbus-phonet.h
@@ -62,6 +62,7 @@ typedef struct {
        int message_type;
        int message_length;
        char *message_buffer;
+       int message_corrupted;
 } phonet_incoming_message;
 
 #endif   /* #ifndef _gnokii_links_fbus_phonet_h */

-----------------------------------------------------------------------

Summary of changes:
 common/links/fbus-phonet.c  |   22 ++++++++++++++++------
 include/links/fbus-phonet.h |    1 +
 2 files changed, 17 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
libgnokii and core programs



reply via email to

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