src/sync.c
branchENGINE-133
changeset 1446 a948c1312c47
parent 1445 5d233bcdde76
child 1447 c5ca494344d9
     1.1 --- a/src/sync.c	Sat Nov 26 03:54:06 2016 +0100
     1.2 +++ b/src/sync.c	Sun Nov 27 02:39:02 2016 +0100
     1.3 @@ -161,9 +161,14 @@
     1.4  
     1.5      log_event(session, "sync_protocol thread started", "pEp sync protocol", NULL, NULL);
     1.6  
     1.7 -    while ((msg = (sync_msg_t *) session->retrieve_next_sync_msg(management, &timeout))) 
     1.8 +    while (true) 
     1.9      {
    1.10 -        if ((status = receive_sync_msg(session, msg, &timeout) != PEP_STATUS_OK)) {
    1.11 +        msg = (sync_msg_t *) session->retrieve_next_sync_msg(management, &timeout);
    1.12 +        if(msg == NULL && timeout == 0)
    1.13 +            break;
    1.14 +        else if(msg == NULL && timeout != 0)
    1.15 +            continue;
    1.16 +        else if ((status = receive_sync_msg(session, msg, &timeout) != PEP_STATUS_OK)) {
    1.17              char buffer[MAX_LINELENGTH];
    1.18              memset(buffer, 0, MAX_LINELENGTH);
    1.19              snprintf(buffer, MAX_LINELENGTH, "problem with msg received: %d\n", (int) status);