Merge lp:~marcustomlinson/unity-scopes-api/oa-test-fix into lp:unity-scopes-api

Proposed by Marcus Tomlinson
Status: Superseded
Proposed branch: lp:~marcustomlinson/unity-scopes-api/oa-test-fix
Merge into: lp:unity-scopes-api
Prerequisite: lp:~michihenning/unity-scopes-api/fix-crossbuild
Diff against target: 36 lines (+13/-1)
1 file modified
src/scopes/internal/OnlineAccountClientImpl.cpp (+13/-1)
To merge this branch: bzr merge lp:~marcustomlinson/unity-scopes-api/oa-test-fix
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+301047@code.launchpad.net
To post a comment you must log in.
685. By Marcus Tomlinson

Don't deadlock waiting for a login session

686. By Marcus Tomlinson

Merge fix-crossbuild

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/scopes/internal/OnlineAccountClientImpl.cpp'
--- src/scopes/internal/OnlineAccountClientImpl.cpp 2016-03-16 12:08:16 +0000
+++ src/scopes/internal/OnlineAccountClientImpl.cpp 2016-07-25 14:57:56 +0000
@@ -545,12 +545,15 @@
545 // (ensures that accounts_ is up to date)545 // (ensures that accounts_ is up to date)
546 std::shared_ptr<GMainLoop> event_loop;546 std::shared_ptr<GMainLoop> event_loop;
547 event_loop.reset(g_main_loop_new(main_loop_context_.get(), true), g_main_loop_unref);547 event_loop.reset(g_main_loop_new(main_loop_context_.get(), true), g_main_loop_unref);
548 while(info->session)548
549 int ms_elapsed = 0;
550 while (info->session && ms_elapsed < 5000)
549 {551 {
550 // We need to wait inside an event loop to allow for the main application loop to552 // We need to wait inside an event loop to allow for the main application loop to
551 // process its pending events553 // process its pending events
552 std::shared_ptr<GSource> source;554 std::shared_ptr<GSource> source;
553 source.reset(g_timeout_source_new(10), g_source_unref);555 source.reset(g_timeout_source_new(10), g_source_unref);
556 ms_elapsed += 10;
554 g_source_set_callback(source.get(), wake_up_event_loop_cb, event_loop.get(), NULL);557 g_source_set_callback(source.get(), wake_up_event_loop_cb, event_loop.get(), NULL);
555 g_source_attach(source.get(), main_loop_context_.get());558 g_source_attach(source.get(), main_loop_context_.get());
556559
@@ -560,6 +563,15 @@
560 lock.lock();563 lock.lock();
561 info_lock.lock();564 info_lock.lock();
562 }565 }
566
567 // If the login session is still not responding, we cancel it
568 if (info->session)
569 {
570 std::cerr << "OnlineAccountClientImpl::flush_pending_session(): login for account: "
571 << info->account_id << " is not responding. Canceling session." << std::endl;
572 signon_auth_session_cancel(info->session.get());
573 info->session = nullptr;
574 }
563}575}
564576
565void OnlineAccountClientImpl::main_loop_state_notify(bool is_running)577void OnlineAccountClientImpl::main_loop_state_notify(bool is_running)

Subscribers

People subscribed via source and target branches

to all changes: