Sure Jens, for example I have a method that trigger the P2P connection:
-(BOOL) setP2P:(NSString *) url{
self.p2pURL = [NSURL URLWithString:url];
self.pullP2p = [self.database createPullReplication: self.p2pURL];
self.pushP2p = [self.database createPushReplication: self.p2pURL];
self.pullP2p.continuous = YES;
self.pushP2p.continuous = YES;
NSNotificationCenter* nctr = [NSNotificationCenter defaultCenter];
[nctr addObserver: self selector: @selector(replicationProgressP2p:)
name: kCBLReplicationChangeNotification object:
self.pullP2p];
[nctr addObserver: self selector: @selector(replicationProgressP2p:)
name: kCBLReplicationChangeNotification object:
self.pushP2p];
//Start sync
[self.pushP2p start];
[self.pullP2p start];
return YES;
}
And this is the callback notifier method:
- (void) replicationProgressP2p: (NSNotificationCenter*)n {
if (self.pullP2p.status == kCBLReplicationActive || self.pushP2p.status
== kCBLReplicationActive) {
// Sync is active -- aggregate the progress of both replications
and compute a fraction:
unsigned completed = self.pullP2p.completedChangesCount +
self.pushP2p.completedChangesCount;
unsigned total = self.pullP2p.changesCount +
self.pushP2p.changesCount;
NSLog(@"P2P SYNC progress: %u / %u", completed, total);
}
}
My problem is that only when is active the method replicationProgressP2p
the peer to peer connection works great, but when the replication becomes
inactive despite I make some local database changes the method
replicationProgressP2p turns active only after several time, in many
scenarios takes more than a minute.
Am I explaining myself?
Thanks for your attention Jens!
El jueves, 16 de abril de 2015, 18:54:22 (UTC-5), Jens Alfke escribió:
>
>
> On Apr 16, 2015, at 2:47 PM, Victor Fernandez <[email protected]
> <javascript:>> wrote:
>
> The replication appears to work fine and quick but only whent it's active
> the notifier method for status KCBLReplicationActive. In other way I have
> to wait like a minute or a minute and a half to this method becomes active
> and make the peer to peer replication.
>
>
> I’m having trouble understanding what you mean. Can you describe the
> behavior in more detail?
>
> —Jens
>
--
You received this message because you are subscribed to the Google Groups
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/mobile-couchbase/9392297d-f72d-48a5-af61-4dc60c075bda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.