Changeset 383

Show
Ignore:
Timestamp:
02/19/08 10:17:05 (9 months ago)
Author:
bellmich
Message:

fixed the sending of splitted packages/commands
(NEXT MESSAGE is received and after all status are managed
there are still commands in the command_queue)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libsyncml/sml_session.c

    r378 r383  
    10771077        } 
    10781078 
     1079        /* A lot of checks are performed before the while loop is executed. 
     1080         * This is necessary because this while loop is only present for one 
     1081         * reason, a NEXT MESSAGE request from the remote peer if the original 
     1082         * message data does not fit into one message (MaxMsgSize to small). 
     1083         * The following stuff is checked: 
     1084         * 
     1085         *     - the session must be in normal mode 
     1086         *         - not sending or waiting 
     1087         *         - no changed message counters 
     1088         *     - there must be a waiting command (not a waiting status!) 
     1089         * 
     1090         * Usually this happens if an image is too large and must be splitted 
     1091         * (MaxMsgSize < MaxObjSize). Do not touch this stuff except that you 
     1092         * really test it with an image which must be send and it is correctly 
     1093         * splitted. 
     1094         */ 
     1095        unsigned int receivedMsg = session->lastReceivedMessageID; 
     1096        unsigned int lastMsg = session->lastMessageID; 
     1097        while (!session->waiting && !session->sending && 
     1098               smlQueueCheck(session->command_queue) && 
     1099               smlQueueLength(session->command_queue) != smlQueueLengthPrio(session->command_queue) && 
     1100               receivedMsg == session->lastReceivedMessageID && 
     1101               lastMsg == session->lastMessageID) 
     1102        { 
     1103                /* If the session does not wait for the remote peer (session->waiting) 
     1104                 * and there is a command in the queue 
     1105                 * then the command is dispatched. 
     1106                 * If the command is too large then the session is automatically 
     1107                 * flushed. If all commands were dispatched then the queue check 
     1108                 * fails and the normal mechanism for sending messages flushes 
     1109                 * the session or do some other actions. 
     1110                 */ 
     1111                smlQueueDispatch(session->command_queue); 
     1112        } 
     1113 
    10791114        smlTrace(TRACE_INTERNAL, "%s: Final %i, waiting %i, sending %i", 
    10801115                __func__, final, session->waiting, session->sending); 
     
    11761211                        if (!alert) 
    11771212                                goto error; 
    1178                                  
     1213 
    11791214                        if (_smlSessionStartCommandInternal(session, alert, NULL, NULL, NULL, TRUE, error) != SML_ASSEMBLER_RESULT_OK) 
    11801215                                goto error; 
    11811216                        if (!_smlSessionEndCommandInternal(session, NULL, error)) 
    11821217                                goto error; 
    1183                          
     1218 
    11841219                        smlCommandUnref(alert); 
    11851220                }