On Thu, Aug 30, 2012 at 12:32 AM, Patrick Ohly <[email protected]> wrote:
> On Wed, 2012-08-29 at 15:13 -0600, Jeremy Whiting wrote:
>> Ok, I've updated my syncpbap branch here:
>> http://cgit.collabora.com/git/user/jwhiting/syncevolution.git but the
>> completeCb and errorCb both never get called, so it just sits there.
>> The transfer does happen, as the file is created and vcard data pumped
>> in,  but something is not right with the signalwatch.
>
> Are you now running with a dbus daemon >= 1.5.0? I'm asking because I
> don't see any changes in your branch to make the path prefix filtering
> work with the older dbus that you were running.

Yes, I've upgraded dbus to version 1.6.4 now.

>
>> Is there a way
>> I can check that the signalwatch is watching the right thing?
>
> You can run with SYNCEVOLUTION_DEBUG=1 G_DBUS_DEBUG=message and
> --daemon=no --print-items to see the D-Bus messages that SyncEvolution
> sends and receives. Watch out for Add/RemoveMatch to see what kind of
> filter it installs on the D-Bus daemon.

Ok, I've attached the log here, it looks to me that we are getting
notified of the Complete (and the Progress signals also) but we don't
seem to be doing anything with them.  The completeCb is never called,
as you don't see "obexd transfer" debug messages in the log anywhere.
Is there a way to check if the boost::bind on those callbacks is
working?  I don't see any warnings or error messages at runtime
either, but maybe boost supresses those or something?

>
> Additional filtering then happens in SignalFilter::matches() inside
> SyncEvolution.
>
>> Btw, feel free to offer any feedback on my use of StringPiece, I think
>> what I have should work, but I've never used it before, so we'll see.
>
> +        pcrecpp::StringPiece content(addr);
>
> Still assumes that memory-mapped "addr" is 0-terminated (how else would
> StringPiece know the length?). Use content(addr, sb.st_size).
>
> +        typedef std::map<std::string, int> CounterMap;
> +        CounterMap counterMap;
>
> Any time you instantiate a std::string with data from "content", string
> data has to be copied.
>
> It would be better to let the Session object own the memory-mapped
> content in a StringPiece, then use StringPiece everywhere else. It can
> be used in standard containers.

Ok, since the vcards no longer need to be parsed to get the id, I
removed the counterMap altogether.

>
> +        string vcarddata;
>
> Should be StringPiece.

If I change that to pcrecpp::StringPiece vcarddata it no longer
builds, since Consume expects it's second argument to be a
std::string.

btw, the boost version here I'm testing with is 1.46.1, that shouldn't
matter, should it?

I believe I've updated according to your other feedback (and force
pushed to my usual syncpbap branch). Let me know if you have any ideas
how I can track down the completeCb never getting called.

thanks,
Jeremy

>
> +        pcrecpp::RE re("(BEGIN:VCARD.*END:VCARD)");
>
> I doubt that this will match (doesn't match line breaks) and if it did,
> it would match all vcards. Doesn't check that START/END occur at the
> start of a line (will therefore fail when it is embedded as comment, for
> example).
>
> pcrecpp::RE re("(^BEGIN:VCARD.*?^END:VCARD)",
> RE_Options().set_dotall(true));
>
> +        while (re.Consume(&content, &vcarddata)) {
> +            typedef std::map<std::string, std::string> VcardMap;
> +            VcardMap vcard;
> +            vcardParse(vcarddata, 0, vcarddata.length(), vcard);
>
> The whole vcardParse can be removed for now. I left it enabled in "PBAP:
> don't try to make up stable local IDs", but there's no need for it at
> the moment.
>
> +            VcardMap::const_iterator it = vcard.find("N");
> +            if(it != vcard.end() && !it->second.empty()) {
> +                const std::string &fn = it->second;
> +
> +                const std::pair<CounterMap::iterator, bool> &r =
> +                    counterMap.insert(CounterMap::value_type(fn, 0));
> +                if(!r.second) {
> +                    r.first->second ++;
> +                }
> +
> +                char suffix[8];
> +                sprintf(suffix, "%07d", r.first->second);
> +
> +                std::string id = fn + std::string(suffix);
> +                dst[id] = vcarddata;
>
> That reverts "PBAP: don't try to make up stable local IDs".
>
> This parsing code now exists in two variants: once for new API, once for
> the old. You can use the StringPiece-based version for both by storing
> the std::string in the Session object and then using a StringPiece which
> references that in-memory data.
>
> --
> Best Regards, Patrick Ohly
>
> The content of this message is my personal opinion only and although
> I am an employee of Intel, the statements I make here in no way
> represent Intel's position on the issue, nor am I authorized to speak
> on behalf of Intel on this matter.
>
>
[DEBUG 00:00:00] Fri 2012-08-31 03:05:51 UTC = 21:05 -0600 MDT
[DEBUG 00:00:00] ---> PBAP::createSource()
========================================================================
GDBus-debug:Message:
  >>>> SENT D-Bus message (128 bytes)
  Type:    method-call
  Flags:   none
  Version: 0
  Serial:  1
  Headers:
    path -> objectpath '/org/freedesktop/DBus'
    interface -> 'org.freedesktop.DBus'
    member -> 'Hello'
    destination -> 'org.freedesktop.DBus'
  Body: ()
  UNIX File Descriptors:
    (none)
========================================================================
GDBus-debug:Message:
  <<<< RECEIVED D-Bus message (90 bytes)
  Type:    method-return
  Flags:   no-reply-expected
  Version: 0
  Serial:  1
  Headers:
    reply-serial -> uint32 1
    destination -> ':1.40'
    sender -> 'org.freedesktop.DBus'
    signature -> signature 's'
  Body: (':1.40',)
  UNIX File Descriptors:
    (none)
[DEBUG 00:00:00] Using new obex org.bluez.obex.Client
========================================================================
GDBus-debug:Message:
  <<<< RECEIVED D-Bus message (170 bytes)
  Type:    signal
  Flags:   no-reply-expected
  Version: 0
  Serial:  2
  Headers:
    path -> objectpath '/org/freedesktop/DBus'
    interface -> 'org.freedesktop.DBus'
    member -> 'NameAcquired'
    destination -> ':1.40'
    sender -> 'org.freedesktop.DBus'
    signature -> signature 's'
  Body: (':1.40',)
  UNIX File Descriptors:
    (none)
========================================================================
GDBus-debug:Message:
  >>>> SENT D-Bus message (193 bytes)
  Type:    method-call
  Flags:   none
  Version: 0
  Serial:  2
  Headers:
    path -> objectpath '/'
    interface -> 'org.bluez.obex.Client'
    member -> 'CreateSession'
    destination -> 'org.bluez.obex.client'
    signature -> signature 'sa{sv}'
  Body: ('CC:8C:E3:11:F2:54', {'Target': <'PBAP'>})
  UNIX File Descriptors:
    (none)
========================================================================
GDBus-debug:Message:
  <<<< RECEIVED D-Bus message (93 bytes)
  Type:    method-return
  Flags:   no-reply-expected
  Version: 0
  Serial:  7
  Headers:
    reply-serial -> uint32 2
    destination -> ':1.40'
    sender -> ':1.36'
    signature -> signature 'o'
  Body: (objectpath '/org/bluez/obex/session0',)
  UNIX File Descriptors:
    (none)
========================================================================
GDBus-debug:Message:
  >>>> SENT D-Bus message (240 bytes)
  Type:    method-call
  Flags:   none
  Version: 0
  Serial:  3
  Headers:
    path -> objectpath '/org/freedesktop/DBus'
    interface -> 'org.freedesktop.DBus'
    member -> 'AddMatch'
    destination -> 'org.freedesktop.DBus'
    signature -> signature 's'
  Body: 
("type='signal',interface='org.bluez.obex.Transfer',path_namespace='/org/bluez/obex/session0'",)
  UNIX File Descriptors:
    (none)
========================================================================
GDBus-debug:Message:
  <<<< RECEIVED D-Bus message (72 bytes)
  Type:    method-return
  Flags:   no-reply-expected
  Version: 0
  Serial:  3
  Headers:
    reply-serial -> uint32 3
    destination -> ':1.40'
    sender -> 'org.freedesktop.DBus'
  Body: ()
  UNIX File Descriptors:
    (none)
========================================================================
GDBus-debug:Message:
  >>>> SENT D-Bus message (240 bytes)
  Type:    method-call
  Flags:   none
  Version: 0
  Serial:  4
  Headers:
    path -> objectpath '/org/freedesktop/DBus'
    interface -> 'org.freedesktop.DBus'
    member -> 'AddMatch'
    destination -> 'org.freedesktop.DBus'
    signature -> signature 's'
  Body: 
("type='signal',interface='org.bluez.obex.Transfer',path_namespace='/org/bluez/obex/session0'",)
  UNIX File Descriptors:
    (none)
========================================================================
GDBus-debug:Message:
  <<<< RECEIVED D-Bus message (72 bytes)
  Type:    method-return
  Flags:   no-reply-expected
  Version: 0
  Serial:  4
  Headers:
    reply-serial -> uint32 4
    destination -> ':1.40'
    sender -> 'org.freedesktop.DBus'
  Body: ()
  UNIX File Descriptors:
    (none)
[DEBUG 00:00:00] PBAP session created: /org/bluez/obex/session0
========================================================================
GDBus-debug:Message:
  >>>> SENT D-Bus message (167 bytes)
  Type:    method-call
  Flags:   none
  Version: 0
  Serial:  5
  Headers:
    path -> objectpath '/org/bluez/obex/session0'
    interface -> 'org.bluez.obex.PhonebookAccess'
    member -> 'Select'
    destination -> 'org.bluez.obex.client'
    signature -> signature 'ss'
  Body: ('int', 'PB')
  UNIX File Descriptors:
    (none)
========================================================================
GDBus-debug:Message:
  <<<< RECEIVED D-Bus message (56 bytes)
  Type:    method-return
  Flags:   no-reply-expected
  Version: 0
  Serial:  8
  Headers:
    reply-serial -> uint32 5
    destination -> ':1.40'
    sender -> ':1.36'
  Body: ()
  UNIX File Descriptors:
    (none)
[DEBUG 00:00:00] Created temporary file for PullAll /tmp/.7W45JW
========================================================================
GDBus-debug:Message:
  >>>> SENT D-Bus message (169 bytes)
  Type:    method-call
  Flags:   none
  Version: 0
  Serial:  6
  Headers:
    path -> objectpath '/org/bluez/obex/session0'
    interface -> 'org.bluez.obex.PhonebookAccess'
    member -> 'PullAll'
    destination -> 'org.bluez.obex.client'
    signature -> signature 's'
  Body: ('/tmp/.7W45JW',)
  UNIX File Descriptors:
    (none)
========================================================================
GDBus-debug:Message:
  <<<< RECEIVED D-Bus message (209 bytes)
  Type:    method-return
  Flags:   no-reply-expected
  Version: 0
  Serial:  9
  Headers:
    reply-serial -> uint32 6
    destination -> ':1.40'
    sender -> ':1.36'
    signature -> signature '(oa{sv})'
  Body: ((objectpath '/org/bluez/obex/session0/transfer0', {'Name': 
<'telecom/pb.vcf'>, 'Size': <uint64 0>, 'Filename': <'/tmp/.7W45JW'>}),)
  UNIX File Descriptors:
    (none)
[DEBUG 00:00:00] pullall transfer path /org/bluez/obex/session0/transfer0, 3 
properties
========================================================================
GDBus-debug:Message:
  <<<< RECEIVED D-Bus message (168 bytes)
  Type:    signal
  Flags:   no-reply-expected
  Version: 0
  Serial:  10
  Headers:
    path -> objectpath '/org/bluez/obex/session0/transfer0'
    interface -> 'org.bluez.obex.Transfer'
    member -> 'PropertyChanged'
    sender -> ':1.36'
    signature -> signature 'sv'
  Body: ('Progress', <int64 12255>)
  UNIX File Descriptors:
    (none)
========================================================================
GDBus-debug:Message:
  <<<< RECEIVED D-Bus message (168 bytes)
  Type:    signal
  Flags:   no-reply-expected
  Version: 0
  Serial:  11
  Headers:
    path -> objectpath '/org/bluez/obex/session0/transfer0'
    interface -> 'org.bluez.obex.Transfer'
    member -> 'PropertyChanged'
    sender -> ':1.36'
    signature -> signature 'sv'
  Body: ('Progress', <int64 32680>)
  UNIX File Descriptors:
    (none)
========================================================================
GDBus-debug:Message:
  <<<< RECEIVED D-Bus message (168 bytes)
  Type:    signal
  Flags:   no-reply-expected
  Version: 0
  Serial:  12
  Headers:
    path -> objectpath '/org/bluez/obex/session0/transfer0'
    interface -> 'org.bluez.obex.Transfer'
    member -> 'PropertyChanged'
    sender -> ':1.36'
    signature -> signature 'sv'
  Body: ('Progress', <int64 49020>)
  UNIX File Descriptors:
    (none)
========================================================================
GDBus-debug:Message:
  <<<< RECEIVED D-Bus message (136 bytes)
  Type:    signal
  Flags:   no-reply-expected
  Version: 0
  Serial:  13
  Headers:
    path -> objectpath '/org/bluez/obex/session0/transfer0'
    interface -> 'org.bluez.obex.Transfer'
    member -> 'Complete'
    sender -> ':1.36'
  Body: ()
  UNIX File Descriptors:
    (none)
_______________________________________________
SyncEvolution mailing list
[email protected]
http://lists.syncevolution.org/listinfo/syncevolution

Reply via email to