LoggerD("Removing session:" << mSession);
- // delete/unref individual contacts
- for(auto it=mContacts.begin(); it!=mContacts.end(); ++it) {
- EContact *contact = (*it).second;
- if(contact) {
- // TODO: delete also all its attribs?
- g_object_unref(contact);
+ // Changing the behavior of removeSession so that when notify is set to false,
+ // we will only close the obex session without destroying cached data, this
+ // unblocks other clients when accessing obex.
+ if (notify) {
+ // delete/unref individual contacts
+ for(auto it=mContacts.begin(); it!=mContacts.end(); ++it) {
+ EContact *contact = (*it).second;
+ if(contact) {
+ // TODO: delete also all its attribs?
+ g_object_unref(contact);
+ }
}
- }
- mContacts.clear();
- mContactsOrder.clear();
-
- // delete/unref individual cll history entries
- for(auto it=mCallHistory.begin(); it!=mCallHistory.end(); ++it) {
- EContact *item = (*it).second;
- if(item) {
- // TODO: delete also all its attribs?
- g_object_unref(item);
+ mContacts.clear();
+ mContactsOrder.clear();
+
+ // delete/unref individual call history entries
+ for(auto it=mCallHistory.begin(); it!=mCallHistory.end(); ++it) {
+ EContact *item = (*it).second;
+ if(item) {
+ // TODO: delete also all its attribs?
+ g_object_unref(item);
+ }
}
+ mCallHistory.clear();
+ mCallHistoryOrder.clear();
}
- mCallHistory.clear();
- mCallHistoryOrder.clear();
GError *err = NULL;
g_dbus_connection_call_sync( g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL),
{
char *status_str=0;
g_variant_get(var, "s", &status_str);
- //LoggerD("Status is: " << status_str);
+ LoggerD("Status is: " << status_str);
if(!strcmp(status_str, "complete"))
{
void Phone::pbSynchronizationDone() {
LoggerD("PB synchronization DONE");
mPBSynchronized = true;
+ // remove session after sync is done to prevent blocking other clients
+ // each sync will now require calling createSession() instead
+ removeSession(false);
}
void Phone::handleMethodCall( GDBusConnection *connection,
}
else {
// the synchronization may be already on-going, but request it anyway
- /*Obex::Error err = */phone->syncContacts();
- /*Obex::Error err = */phone->syncCallHistory();
+ phone->createSession(phone->mWantedRemoteDevice.c_str());
}
}
else {
}
else if(!strcmp(method_name, "Synchronize")) {
LoggerD("Synchronizing data with the phone");
- /*Obex::Error err = */phone->syncContacts();
- /*Obex::Error err = */phone->syncCallHistory();
+ phone->createSession(phone->mWantedRemoteDevice.c_str());
g_dbus_method_invocation_return_value(invocation, NULL);
}
else if(!strcmp(method_name, "GetContacts")) {