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
1=== modified file 'src/scopes/internal/OnlineAccountClientImpl.cpp'
2--- src/scopes/internal/OnlineAccountClientImpl.cpp 2016-03-16 12:08:16 +0000
3+++ src/scopes/internal/OnlineAccountClientImpl.cpp 2016-07-25 14:57:56 +0000
4@@ -545,12 +545,15 @@
5 // (ensures that accounts_ is up to date)
6 std::shared_ptr<GMainLoop> event_loop;
7 event_loop.reset(g_main_loop_new(main_loop_context_.get(), true), g_main_loop_unref);
8- while(info->session)
9+
10+ int ms_elapsed = 0;
11+ while (info->session && ms_elapsed < 5000)
12 {
13 // We need to wait inside an event loop to allow for the main application loop to
14 // process its pending events
15 std::shared_ptr<GSource> source;
16 source.reset(g_timeout_source_new(10), g_source_unref);
17+ ms_elapsed += 10;
18 g_source_set_callback(source.get(), wake_up_event_loop_cb, event_loop.get(), NULL);
19 g_source_attach(source.get(), main_loop_context_.get());
20
21@@ -560,6 +563,15 @@
22 lock.lock();
23 info_lock.lock();
24 }
25+
26+ // If the login session is still not responding, we cancel it
27+ if (info->session)
28+ {
29+ std::cerr << "OnlineAccountClientImpl::flush_pending_session(): login for account: "
30+ << info->account_id << " is not responding. Canceling session." << std::endl;
31+ signon_auth_session_cancel(info->session.get());
32+ info->session = nullptr;
33+ }
34 }
35
36 void OnlineAccountClientImpl::main_loop_state_notify(bool is_running)

Subscribers

People subscribed via source and target branches

to all changes: