src/sync.c
changeset 1603 f954f77387f1
parent 1513 e7f7e42385b5
child 1622 4460e54ed8ba
     1.1 --- a/src/sync.c	Wed Feb 22 19:26:45 2017 +0100
     1.2 +++ b/src/sync.c	Wed Feb 22 23:23:41 2017 +0100
     1.3 @@ -59,32 +59,36 @@
     1.4      if (!(session && sync_session && sync_session->sync_management && sync_session->inject_sync_msg ))
     1.5          return PEP_ILLEGAL_VALUE;
     1.6  
     1.7 -    memcpy(session->sync_uuid, sync_session->sync_uuid, 37);
     1.8 +    session->sync_session = sync_session;
     1.9 +    // memcpy(session->sync_uuid, sync_session->sync_uuid, 37);
    1.10  
    1.11 -    session->sync_management = sync_session->sync_management;
    1.12 -    session->inject_sync_msg = sync_session->inject_sync_msg;
    1.13 +    // session->sync_management = sync_session->sync_management;
    1.14 +    // session->inject_sync_msg = sync_session->inject_sync_msg;
    1.15  
    1.16      return PEP_STATUS_OK;
    1.17  }
    1.18  
    1.19  DYNAMIC_API PEP_STATUS detach_sync_session(PEP_SESSION session)
    1.20  {
    1.21 -    assert(session && session->sync_management && session->inject_sync_msg );
    1.22 -    if (!(session && session->sync_management && session->inject_sync_msg ))
    1.23 +    assert(session);
    1.24 +    if (!(session))
    1.25          return PEP_ILLEGAL_VALUE;
    1.26  
    1.27 -    memset(session->sync_uuid, 0, 37);
    1.28 +    session->sync_session = session;
    1.29 +    // memset(session->sync_uuid, 0, 37);
    1.30  
    1.31 -    session->sync_management = NULL;
    1.32 -    session->inject_sync_msg = NULL;
    1.33 +    // session->sync_management = NULL;
    1.34 +    // session->inject_sync_msg = NULL;
    1.35  
    1.36      return PEP_STATUS_OK;
    1.37  }
    1.38  
    1.39  int call_inject_sync_msg(PEP_SESSION session, void *msg)
    1.40  {
    1.41 -    if(session->inject_sync_msg && session->sync_management)
    1.42 -        return session->inject_sync_msg(msg, session->sync_management);
    1.43 +    if(session->sync_session->inject_sync_msg &&
    1.44 +       session->sync_session->sync_management)
    1.45 +        return session->sync_session->inject_sync_msg(msg, 
    1.46 +            session->sync_session->sync_management);
    1.47      else
    1.48         return PEP_SYNC_NO_INJECT_CALLBACK;
    1.49  }