Re: connmanctl quitting before multiple return functions called
Hi, On Thu, 2015-10-15 at 15:41 +1100, Craig McQueen wrote: > I agree, it would be best if connmanctl exits after all the method > calls have completed. I'd be happy to do a patch in principle, however > I'm new to this D-Bus stuff and unfamiliar with the connman codebase, > so at this point I'm not sure what is an architecturally elegant way > to fix this. E.g., would it a counter which increments for each method > call, and decrements when its response is received Yes, that should work. > (and if so, does it need locks to be thread safe)? This is entirely single threaded using a main loop. No locking structures needed. > Or, is there some existing D-Bus code that already provides such > functionality, e.g. returning true when there are no method calls > waiting for a response? Currently not. Looks like the 'config' command has the same problem here. But that is a different "bug"... Cheers, Patrik ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
RE: connmanctl quitting before multiple return functions called
Patrik write: > On Wed, 2015-10-14 at 17:49 +1100, Craig McQueen wrote: > > I've been looking into extending connmanctl's functionality with > > configuration for the net.connman.Clock API. I've been developing a > > command that can set clock properties, similar to the existing > > "config" command. > > > > I've noticed that when multiple parameters are set, then the 'return' > > function is often not called. E.g.: > > > > connmanctl config ethernet_4a4a5a6a3a0a_cable --ipv6 off > > --autoconnect yes --timeservers 0.pool.ntp.org > > > > In this case, it sends 3 D-Bus commands, and config_return() should be > > called for each response. But it is likely to shutdown before calling > > config_return() all three times. > > > > I see that dbus_method_reply() calls __connmanctl_quit(). That seems > > to be implicated in this. It seems the logic is to initiate shutdown > > after the response is received for the first D-Bus message sent. > > The logic has a bug here. It would be best if connmanctl exits after all > the method calls have completed. You are always free to send a patch for > this or implement it properly for Clock API commands, if you intend to > send patches for supporting that. I've sent a patch of the connmanctl commands for Clock API. It works okay for my purposes, although it doesn't fix this issue. It works okay if getting only one property. This issue can be seen with the 'clock' command, reading multiple items. E.g.: connmanctl clock time timeupdates timezone which on my ARM embedded Linux based system, sometimes gets all three responses, but often only two. I agree, it would be best if connmanctl exits after all the method calls have completed. I'd be happy to do a patch in principle, however I'm new to this D-Bus stuff and unfamiliar with the connman codebase, so at this point I'm not sure what is an architecturally elegant way to fix this. E.g., would it a counter which increments for each method call, and decrements when its response is received (and if so, does it need locks to be thread safe)? Or, is there some existing D-Bus code that already provides such functionality, e.g. returning true when there are no method calls waiting for a response? -- Craig McQueen ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
Re: connmanctl quitting before multiple return functions called
Hi, On Wed, 2015-10-14 at 17:49 +1100, Craig McQueen wrote: > I've been looking into extending connmanctl's functionality with > configuration for the net.connman.Clock API. I've been developing a > command that can set clock properties, similar to the existing > "config" command. > > I've noticed that when multiple parameters are set, then the 'return' > function is often not called. E.g.: > > connmanctl config ethernet_4a4a5a6a3a0a_cable --ipv6 off > --autoconnect yes --timeservers 0.pool.ntp.org > > In this case, it sends 3 D-Bus commands, and config_return() should be > called for each response. But it is likely to shutdown before calling > config_return() all three times. > > I see that dbus_method_reply() calls __connmanctl_quit(). That seems > to be implicated in this. It seems the logic is to initiate shutdown > after the response is received for the first D-Bus message sent. The logic has a bug here. It would be best if connmanctl exits after all the method calls have completed. You are always free to send a patch for this or implement it properly for Clock API commands, if you intend to send patches for supporting that. Cheers, Patrik ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
connmanctl quitting before multiple return functions called
I've been looking into extending connmanctl's functionality with configuration for the net.connman.Clock API. I've been developing a command that can set clock properties, similar to the existing "config" command. I've noticed that when multiple parameters are set, then the 'return' function is often not called. E.g.: connmanctl config ethernet_4a4a5a6a3a0a_cable --ipv6 off --autoconnect yes --timeservers 0.pool.ntp.org In this case, it sends 3 D-Bus commands, and config_return() should be called for each response. But it is likely to shutdown before calling config_return() all three times. I see that dbus_method_reply() calls __connmanctl_quit(). That seems to be implicated in this. It seems the logic is to initiate shutdown after the response is received for the first D-Bus message sent. -- Craig McQueen ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman