Mir

Merge lp:~afrantzis/mir/accept-connections-only-when-server-is-ready into lp:mir

Proposed by Alexandros Frantzis
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 2553
Proposed branch: lp:~afrantzis/mir/accept-connections-only-when-server-is-ready
Merge into: lp:mir
Prerequisite: lp:~afrantzis/mir/refactor-main-loop-events-test
Diff against target: 152 lines (+27/-27)
2 files modified
src/server/display_server.cpp (+21/-21)
tests/integration-tests/test_display_server_main_loop_events.cpp (+6/-6)
To merge this branch: bzr merge lp:~afrantzis/mir/accept-connections-only-when-server-is-ready
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
Kevin DuBois (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+258343@code.launchpad.net

Commit message

server: Accept connections only after all subsystems have been initialized (LP: #1451844)

Description of the change

server: Accept connections only after all subsystems have been initialized (LP: #1451844)

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

okay

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/server/display_server.cpp'
2--- src/server/display_server.cpp 2015-04-22 07:57:12 +0000
3+++ src/server/display_server.cpp 2015-05-06 08:19:05 +0000
4@@ -98,6 +98,14 @@
5 {
6 try
7 {
8+ TryButRevertIfUnwinding comm{
9+ [this] { connector->stop(); },
10+ [this] { connector->start(); }};
11+
12+ TryButRevertIfUnwinding prompt{
13+ [this] { prompt_connector->stop(); },
14+ [this] { prompt_connector->start(); }};
15+
16 TryButRevertIfUnwinding dispatcher{
17 [this] { input_dispatcher->stop(); },
18 [this] { input_dispatcher->start(); }};
19@@ -110,14 +118,6 @@
20 [this] { display_changer->pause_display_config_processing(); },
21 [this] { display_changer->resume_display_config_processing(); }};
22
23- TryButRevertIfUnwinding prompt{
24- [this] { prompt_connector->stop(); },
25- [this] { prompt_connector->start(); }};
26-
27- TryButRevertIfUnwinding comm{
28- [this] { connector->stop(); },
29- [this] { connector->start(); }};
30-
31 TryButRevertIfUnwinding comp{
32 [this] { compositor->stop(); },
33 [this] { compositor->start(); }};
34@@ -146,14 +146,6 @@
35 [this] { compositor->start(); },
36 [this] { compositor->stop(); }};
37
38- TryButRevertIfUnwinding comm{
39- [this] { connector->start(); },
40- [this] { connector->stop(); }};
41-
42- TryButRevertIfUnwinding prompt{
43- [this] { prompt_connector->start(); },
44- [this] { prompt_connector->stop(); }};
45-
46 TryButRevertIfUnwinding display_config_processing{
47 [this] { display_changer->resume_display_config_processing(); },
48 [this] { display_changer->pause_display_config_processing(); }};
49@@ -162,7 +154,15 @@
50 [this] { input_manager->start(); },
51 [this] { input_manager->stop(); }};
52
53- input_dispatcher->start();
54+ TryButRevertIfUnwinding dispatcher{
55+ [this] { input_dispatcher->start(); },
56+ [this] { input_dispatcher->stop(); }};
57+
58+ TryButRevertIfUnwinding prompt{
59+ [this] { prompt_connector->start(); },
60+ [this] { prompt_connector->stop(); }};
61+
62+ connector->start();
63 }
64 catch(std::runtime_error const&)
65 {
66@@ -213,19 +213,19 @@
67 mir::log_info("Mir version " MIR_VERSION);
68
69 p->compositor->start();
70- p->connector->start();
71- p->prompt_connector->start();
72 p->input_manager->start();
73 p->input_dispatcher->start();
74+ p->prompt_connector->start();
75+ p->connector->start();
76
77 p->server_status_listener->started();
78
79 p->main_loop->run();
80
81+ p->connector->stop();
82+ p->prompt_connector->stop();
83 p->input_dispatcher->stop();
84 p->input_manager->stop();
85- p->prompt_connector->stop();
86- p->connector->stop();
87 p->compositor->stop();
88 }
89
90
91=== modified file 'tests/integration-tests/test_display_server_main_loop_events.cpp'
92--- tests/integration-tests/test_display_server_main_loop_events.cpp 2015-05-06 08:19:05 +0000
93+++ tests/integration-tests/test_display_server_main_loop_events.cpp 2015-05-06 08:19:05 +0000
94@@ -363,16 +363,16 @@
95 void expect_start()
96 {
97 EXPECT_CALL(*mock_compositor, start()).Times(1);
98- EXPECT_CALL(*mock_connector, start()).Times(1);
99 EXPECT_CALL(*mock_input_manager, start()).Times(1);
100 EXPECT_CALL(*mock_input_dispatcher, start()).Times(1);
101+ EXPECT_CALL(*mock_connector, start()).Times(1);
102 }
103
104 void expect_pause()
105 {
106+ EXPECT_CALL(*mock_connector, stop()).Times(1);
107 EXPECT_CALL(*mock_input_dispatcher, stop()).Times(1);
108 EXPECT_CALL(*mock_input_manager, stop()).Times(1);
109- EXPECT_CALL(*mock_connector, stop()).Times(1);
110 EXPECT_CALL(*mock_compositor, stop()).Times(1);
111 EXPECT_CALL(*mock_display, pause()).Times(1);
112 }
113@@ -381,16 +381,16 @@
114 {
115 EXPECT_CALL(*mock_display, resume()).Times(1);
116 EXPECT_CALL(*mock_compositor, start()).Times(1);
117- EXPECT_CALL(*mock_connector, start()).Times(1);
118 EXPECT_CALL(*mock_input_manager, start()).Times(1);
119 EXPECT_CALL(*mock_input_dispatcher, start()).Times(1);
120+ EXPECT_CALL(*mock_connector, start()).Times(1);
121 }
122
123 void expect_stop()
124 {
125+ EXPECT_CALL(*mock_connector, stop()).Times(1);
126 EXPECT_CALL(*mock_input_dispatcher, stop()).Times(1);
127 EXPECT_CALL(*mock_input_manager, stop()).Times(1);
128- EXPECT_CALL(*mock_connector, stop()).Times(1);
129 EXPECT_CALL(*mock_compositor, stop()).Times(1);
130 }
131
132@@ -504,18 +504,18 @@
133 expect_start();
134
135 /* Pause failure */
136+ EXPECT_CALL(*mock_connector, stop()).Times(1);
137 EXPECT_CALL(*mock_input_dispatcher, stop()).Times(1);
138 EXPECT_CALL(*mock_input_manager, stop()).Times(1);
139- EXPECT_CALL(*mock_connector, stop()).Times(1);
140 EXPECT_CALL(*mock_compositor, stop()).Times(1);
141 EXPECT_CALL(*mock_display, pause())
142 .WillOnce(Throw(std::runtime_error("")));
143
144 /* Attempt to continue */
145 EXPECT_CALL(*mock_compositor, start()).Times(1);
146- EXPECT_CALL(*mock_connector, start()).Times(1);
147 EXPECT_CALL(*mock_input_manager, start()).Times(1);
148 EXPECT_CALL(*mock_input_dispatcher, start()).Times(1);
149+ EXPECT_CALL(*mock_connector, start()).Times(1);
150
151 expect_stop();
152 }

Subscribers

People subscribed via source and target branches