src/sync.c
branchENGINE-133
changeset 1445 5d233bcdde76
parent 1330 0c55ede4d522
child 1446 a948c1312c47
     1.1 --- a/src/sync.c	Fri Nov 25 15:59:58 2016 +0100
     1.2 +++ b/src/sync.c	Sat Nov 26 03:54:06 2016 +0100
     1.3 @@ -10,7 +10,8 @@
     1.4  
     1.5  PEP_STATUS receive_sync_msg(
     1.6          PEP_SESSION session,
     1.7 -        sync_msg_t *sync_msg
     1.8 +        sync_msg_t *sync_msg,
     1.9 +        time_t *timeout
    1.10      );
    1.11  
    1.12  DYNAMIC_API PEP_STATUS register_sync_callbacks(
    1.13 @@ -38,7 +39,8 @@
    1.14  
    1.15      // start state machine
    1.16      session->sync_state = InitState;
    1.17 -    PEP_STATUS status = fsm_DeviceState_inject(session, Init, NULL, NULL);
    1.18 +    time_t unused = 0;
    1.19 +    PEP_STATUS status = fsm_DeviceState_inject(session, Init, NULL, NULL, &unused);
    1.20      if (status != PEP_STATUS_OK)
    1.21          unregister_sync_callbacks(session);
    1.22  
    1.23 @@ -149,6 +151,7 @@
    1.24  {
    1.25      sync_msg_t *msg = NULL;
    1.26      PEP_STATUS status = PEP_STATUS_OK;
    1.27 +    time_t timeout = 0;
    1.28  
    1.29      assert(session && session->retrieve_next_sync_msg);
    1.30      assert(management);
    1.31 @@ -158,9 +161,9 @@
    1.32  
    1.33      log_event(session, "sync_protocol thread started", "pEp sync protocol", NULL, NULL);
    1.34  
    1.35 -    while ((msg = (sync_msg_t *) session->retrieve_next_sync_msg(management))) 
    1.36 +    while ((msg = (sync_msg_t *) session->retrieve_next_sync_msg(management, &timeout))) 
    1.37      {
    1.38 -        if ((status = receive_sync_msg(session, msg) != PEP_STATUS_OK)) {
    1.39 +        if ((status = receive_sync_msg(session, msg, &timeout) != PEP_STATUS_OK)) {
    1.40              char buffer[MAX_LINELENGTH];
    1.41              memset(buffer, 0, MAX_LINELENGTH);
    1.42              snprintf(buffer, MAX_LINELENGTH, "problem with msg received: %d\n", (int) status);