Re: [RFC PATCH 2/4] gprs: add automatic context settings provisioning
Hi Jukka, > diff --git a/src/gprs.c b/src/gprs.c > index 58166f8..7d188a3 100644 > --- a/src/gprs.c > +++ b/src/gprs.c > @@ -43,6 +43,7 @@ > #include "common.h" > #include "storage.h" > #include "idmap.h" > +#include "gprs-provision.h" > > #define GPRS_FLAG_ATTACHING 0x1 > #define GPRS_FLAG_RECHECK 0x2 > @@ -2454,13 +2455,15 @@ remove: > storage_sync(imsi, SETTINGS_STORE, gprs->settings); > } > > -void ofono_gprs_register(struct ofono_gprs *gprs) > +static void ofono_gprs_finish_register(struct ofono_gprs *gprs) > { > DBusConnection *conn = ofono_dbus_get_connection(); > struct ofono_modem *modem = __ofono_atom_get_modem(gprs->atom); > const char *path = __ofono_atom_get_path(gprs->atom); > struct ofono_atom *netreg_atom; > - struct ofono_atom *sim_atom; > + > + if (gprs->contexts == NULL) /* Automatic provisioning failed */ > + add_context(gprs, NULL, OFONO_GPRS_CONTEXT_TYPE_INTERNET); so I see a potential race here between the UI trying to provision and us trying to provision. We don't wanna end up with duplicated contexts here. Any ideas on how we could prevent that nicely? Or should we just fail any attempts to create new contexts if provisioning is still ongoing? Regards Marcel ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [RFC PATCH 2/4] gprs: add automatic context settings provisioning
Hello Marcel, On Tue, 2011-01-11 at 22:51 -0800, ext Marcel Holtmann wrote: > > > > -void ofono_gprs_register(struct ofono_gprs *gprs) > > +static void ofono_gprs_finish_register(struct ofono_gprs *gprs) > > { > > DBusConnection *conn = ofono_dbus_get_connection(); > > struct ofono_modem *modem = __ofono_atom_get_modem(gprs->atom); > > const char *path = __ofono_atom_get_path(gprs->atom); > > struct ofono_atom *netreg_atom; > > - struct ofono_atom *sim_atom; > > + > > + if (gprs->contexts == NULL) /* Automatic provisioning failed */ > > + add_context(gprs, NULL, OFONO_GPRS_CONTEXT_TYPE_INTERNET); > > so I see a potential race here between the UI trying to provision and us > trying to provision. > > We don't wanna end up with duplicated contexts here. Any ideas on how we > could prevent that nicely? Or should we just fail any attempts to create > new contexts if provisioning is still ongoing? Code continues there with: if (!g_dbus_register_interface(conn, path, OFONO_CONNECTION_MANAGER_INTERFACE, manager_methods, manager_signals, NULL, gprs, NULL)) { ofono_error("Could not create %s interface", OFONO_CONNECTION_MANAGER_INTERFACE); return; } ofono_modem_add_interface(modem, OFONO_CONNECTION_MANAGER_INTERFACE); Patch rearranges the initial context creation and interface registration, so there is no DBUS interface for UI to use until provisioning is ready. Or have misunderstood something? --Jukka ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [RFC PATCH 2/4] gprs: add automatic context settings provisioning
Hi Jukka, > > > -void ofono_gprs_register(struct ofono_gprs *gprs) > > > +static void ofono_gprs_finish_register(struct ofono_gprs *gprs) > > > { > > > DBusConnection *conn = ofono_dbus_get_connection(); > > > struct ofono_modem *modem = __ofono_atom_get_modem(gprs->atom); > > > const char *path = __ofono_atom_get_path(gprs->atom); > > > struct ofono_atom *netreg_atom; > > > - struct ofono_atom *sim_atom; > > > + > > > + if (gprs->contexts == NULL) /* Automatic provisioning failed */ > > > + add_context(gprs, NULL, OFONO_GPRS_CONTEXT_TYPE_INTERNET); > > > > so I see a potential race here between the UI trying to provision and us > > trying to provision. > > > > We don't wanna end up with duplicated contexts here. Any ideas on how we > > could prevent that nicely? Or should we just fail any attempts to create > > new contexts if provisioning is still ongoing? > > Code continues there with: > if (!g_dbus_register_interface(conn, path, > OFONO_CONNECTION_MANAGER_INTERFACE, > manager_methods, manager_signals, NULL, > gprs, NULL)) { > ofono_error("Could not create %s interface", > OFONO_CONNECTION_MANAGER_INTERFACE); > > return; > } > > ofono_modem_add_interface(modem, > OFONO_CONNECTION_MANAGER_INTERFACE); > > Patch rearranges the initial context creation and interface > registration, so there is no DBUS interface for UI to use until > provisioning is ready. Or have misunderstood something? it could we well that I got lost in the re-arranged code ;) If we wait with the Connection Manager interface registration until we ran through all provision drivers, that seems fine. So no concerns from my part then on the potential race conditions with the UI. Regards Marcel ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono