CBLListener readonly property prevents peer-to-peer sync

24 views
Skip to first unread message

Brendan Duddridge

unread,
Feb 2, 2016, 9:27:31 PM2/2/16
to Couchbase Mobile
Hi Jens,

So I was watching your peer-to-peer sync presentation yesterday and I saw you recommended setting the readOnly property on CBLListener. I tried that yesterday and it seemed to prevent the database from being updated from the pull. I thought that the readOnly property would be just for pushes? You mentioned that it prevents someone from pushing a revision to the listener, but shouldn't prevent pulls from other listeners. 

I've based my peer sync code on your Bonjour Grocery Sync example (although in Objective-C instead of Swift). And it works perfectly when the CBLListener readOnly property is NO. So not sure if I'm just doing something wrong or does readOnly actually prevent pulls too?

Here's some log messages to show what's happening to the puller:

Sync: CBLRestPuller[https://iPhone-6s.local.:49743/db-d9b8dd6ae89c48da9637bfba68b35f9a]: Server is CouchbaseLite 1.2 (unofficial)
Sync: CBLRestPuller[https://iPhone-6s.local.:49743/db-d9b8dd6ae89c48da9637bfba68b35f9a]: Replicating from lastSequence=802
SyncVerbose: CBLRestPuller[https://iPhone-6s.local.:49743/db-d9b8dd6ae89c48da9637bfba68b35f9a] starting ChangeTracker: mode=0, since=802
SyncVerbose: CBLSocketChangeTracker[0x6100001bfd40 db-d9b8dd6ae89c48da9637bfba68b35f9a]: POST //iPhone-6s.local.:49743/db-d9b8dd6ae89c48da9637bfba68b35f9a/_changes
CBLSocketChangeTracker[0x6100001bfd40 db-d9b8dd6ae89c48da9637bfba68b35f9a]: Cant connect, giving up: Error Domain=CBLHTTP Code=403 "403 forbidden" UserInfo={NSURL=https://iPhone-6s.local.:49743/db-d9b8dd6ae89c48da9637bfba68b35f9a/_changes, NSLocalizedFailureReason=forbidden, NSLocalizedDescription=403 forbidden}
Sync: CBLRestPuller[https://iPhone-6s.local.:49743/db-d9b8dd6ae89c48da9637bfba68b35f9a]: ChangeTracker stopped; error=Error Domain=CBLHTTP Code=403 "403 forbidden" UserInfo={NSURL=https://iPhone-6s.local.:49743/db-d9b8dd6ae89c48da9637bfba68b35f9a/_changes, NSLocalizedFailureReason=forbidden, NSLocalizedDescription=403 forbidden}
Sync: CBLRestPuller[https://iPhone-6s.local.:49743/db-d9b8dd6ae89c48da9637bfba68b35f9a] Progress: set error = 403 forbidden
Sync: CBLRestPuller[https://iPhone-6s.local.:49743/db-d9b8dd6ae89c48da9637bfba68b35f9a] STOPPING...



So basically it's forbidden. I thought it was supposed to be forbidden for pushing, but not for pulling?


Thanks,

Brendan

Jens Alfke

unread,
Feb 5, 2016, 5:27:42 PM2/5/16
to Couchbase Mobile, Brendan Duddridge

> On Feb 2, 2016, at 6:27 PM, Brendan Duddridge <bren...@gmail.com> wrote:
>
> Hi Jens,
>
> So I was watching your peer-to-peer sync presentation yesterday and I saw you recommended setting the readOnly property on CBLListener. I tried that yesterday and it seemed to prevent the database from being updated from the pull. I thought that the readOnly property would be just for pushes? You mentioned that it prevents someone from pushing a revision to the listener, but shouldn't prevent pulls from other listeners.

This looks like a bug. From the logs, I think what’s going on is that the read-only listener is refusing all POST requests on the assumption that they will change the database. But (in 1.2) we use POST to the _changes feed, with the same semantics as a GET.

Could you file an issue please?

—Jens

Brendan Duddridge

unread,
Feb 5, 2016, 9:12:05 PM2/5/16
to Couchbase Mobile, bren...@gmail.com
Hi Jens,


Thanks!

Brendan
Reply all
Reply to author
Forward
0 new messages