Added Sync fastpolling
authorEdouard Tisserant <edouard@pep-project.org>
Thu, 18 May 2017 14:51:37 +0200
changeset 1929e94360802b5
parent 191 c0872370f8fa
child 193 0d26e0a12324
Added Sync fastpolling
pEpObjCAdapter/PEPObjCAdapter.h
pEpObjCAdapter/PEPObjCAdapter.m
     1.1 --- a/pEpObjCAdapter/PEPObjCAdapter.h	Wed May 17 17:57:53 2017 +0200
     1.2 +++ b/pEpObjCAdapter/PEPObjCAdapter.h	Thu May 18 14:51:37 2017 +0200
     1.3 @@ -23,6 +23,8 @@
     1.4  
     1.5  - (PEP_STATUS)sendMessage:(id)msg;
     1.6  
     1.7 +- (PEP_STATUS)fastPolling:(bool)isfast;
     1.8 +
     1.9  @end
    1.10  
    1.11  @interface PEPObjCAdapter : NSObject
     2.1 --- a/pEpObjCAdapter/PEPObjCAdapter.m	Wed May 17 17:57:53 2017 +0200
     2.2 +++ b/pEpObjCAdapter/PEPObjCAdapter.m	Thu May 18 14:51:37 2017 +0200
     2.3 @@ -82,9 +82,22 @@
     2.4  // Called by sync thread only
     2.5  void *retrieve_next_sync_msg(void *unused_mamagement, time_t *timeout)
     2.6  {
     2.7 +    bool needs_fastpoll = (*timeout != 0);
     2.8 +    
     2.9 +    id <PEPSyncDelegate> syncDelegate = [PEPObjCAdapter getSyncDelegate];
    2.10 +    if ( syncDelegate && needs_fastpoll )
    2.11 +        [syncDelegate fastPolling:true];
    2.12 +    
    2.13      PEPQueue *q = [PEPObjCAdapter getSyncQueue];
    2.14 +
    2.15 +    // TODO : implement timeout
    2.16 +    void* result = (void*)[[q dequeue] pointerValue];
    2.17 +
    2.18 +    if ( syncDelegate && needs_fastpoll )
    2.19 +        [syncDelegate fastPolling:false];
    2.20      
    2.21 -    return (void*)[[q dequeue] pointerValue];
    2.22 +    return result;
    2.23 +
    2.24  }
    2.25  
    2.26