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
=== modified file 'src/server/display_server.cpp'
--- src/server/display_server.cpp 2015-04-22 07:57:12 +0000
+++ src/server/display_server.cpp 2015-05-06 08:19:05 +0000
@@ -98,6 +98,14 @@
98 {98 {
99 try99 try
100 {100 {
101 TryButRevertIfUnwinding comm{
102 [this] { connector->stop(); },
103 [this] { connector->start(); }};
104
105 TryButRevertIfUnwinding prompt{
106 [this] { prompt_connector->stop(); },
107 [this] { prompt_connector->start(); }};
108
101 TryButRevertIfUnwinding dispatcher{109 TryButRevertIfUnwinding dispatcher{
102 [this] { input_dispatcher->stop(); },110 [this] { input_dispatcher->stop(); },
103 [this] { input_dispatcher->start(); }};111 [this] { input_dispatcher->start(); }};
@@ -110,14 +118,6 @@
110 [this] { display_changer->pause_display_config_processing(); },118 [this] { display_changer->pause_display_config_processing(); },
111 [this] { display_changer->resume_display_config_processing(); }};119 [this] { display_changer->resume_display_config_processing(); }};
112120
113 TryButRevertIfUnwinding prompt{
114 [this] { prompt_connector->stop(); },
115 [this] { prompt_connector->start(); }};
116
117 TryButRevertIfUnwinding comm{
118 [this] { connector->stop(); },
119 [this] { connector->start(); }};
120
121 TryButRevertIfUnwinding comp{121 TryButRevertIfUnwinding comp{
122 [this] { compositor->stop(); },122 [this] { compositor->stop(); },
123 [this] { compositor->start(); }};123 [this] { compositor->start(); }};
@@ -146,14 +146,6 @@
146 [this] { compositor->start(); },146 [this] { compositor->start(); },
147 [this] { compositor->stop(); }};147 [this] { compositor->stop(); }};
148148
149 TryButRevertIfUnwinding comm{
150 [this] { connector->start(); },
151 [this] { connector->stop(); }};
152
153 TryButRevertIfUnwinding prompt{
154 [this] { prompt_connector->start(); },
155 [this] { prompt_connector->stop(); }};
156
157 TryButRevertIfUnwinding display_config_processing{149 TryButRevertIfUnwinding display_config_processing{
158 [this] { display_changer->resume_display_config_processing(); },150 [this] { display_changer->resume_display_config_processing(); },
159 [this] { display_changer->pause_display_config_processing(); }};151 [this] { display_changer->pause_display_config_processing(); }};
@@ -162,7 +154,15 @@
162 [this] { input_manager->start(); },154 [this] { input_manager->start(); },
163 [this] { input_manager->stop(); }};155 [this] { input_manager->stop(); }};
164156
165 input_dispatcher->start();157 TryButRevertIfUnwinding dispatcher{
158 [this] { input_dispatcher->start(); },
159 [this] { input_dispatcher->stop(); }};
160
161 TryButRevertIfUnwinding prompt{
162 [this] { prompt_connector->start(); },
163 [this] { prompt_connector->stop(); }};
164
165 connector->start();
166 }166 }
167 catch(std::runtime_error const&)167 catch(std::runtime_error const&)
168 {168 {
@@ -213,19 +213,19 @@
213 mir::log_info("Mir version " MIR_VERSION);213 mir::log_info("Mir version " MIR_VERSION);
214214
215 p->compositor->start();215 p->compositor->start();
216 p->connector->start();
217 p->prompt_connector->start();
218 p->input_manager->start();216 p->input_manager->start();
219 p->input_dispatcher->start();217 p->input_dispatcher->start();
218 p->prompt_connector->start();
219 p->connector->start();
220220
221 p->server_status_listener->started();221 p->server_status_listener->started();
222222
223 p->main_loop->run();223 p->main_loop->run();
224224
225 p->connector->stop();
226 p->prompt_connector->stop();
225 p->input_dispatcher->stop();227 p->input_dispatcher->stop();
226 p->input_manager->stop();228 p->input_manager->stop();
227 p->prompt_connector->stop();
228 p->connector->stop();
229 p->compositor->stop();229 p->compositor->stop();
230}230}
231231
232232
=== modified file 'tests/integration-tests/test_display_server_main_loop_events.cpp'
--- tests/integration-tests/test_display_server_main_loop_events.cpp 2015-05-06 08:19:05 +0000
+++ tests/integration-tests/test_display_server_main_loop_events.cpp 2015-05-06 08:19:05 +0000
@@ -363,16 +363,16 @@
363 void expect_start()363 void expect_start()
364 {364 {
365 EXPECT_CALL(*mock_compositor, start()).Times(1);365 EXPECT_CALL(*mock_compositor, start()).Times(1);
366 EXPECT_CALL(*mock_connector, start()).Times(1);
367 EXPECT_CALL(*mock_input_manager, start()).Times(1);366 EXPECT_CALL(*mock_input_manager, start()).Times(1);
368 EXPECT_CALL(*mock_input_dispatcher, start()).Times(1);367 EXPECT_CALL(*mock_input_dispatcher, start()).Times(1);
368 EXPECT_CALL(*mock_connector, start()).Times(1);
369 }369 }
370370
371 void expect_pause()371 void expect_pause()
372 {372 {
373 EXPECT_CALL(*mock_connector, stop()).Times(1);
373 EXPECT_CALL(*mock_input_dispatcher, stop()).Times(1);374 EXPECT_CALL(*mock_input_dispatcher, stop()).Times(1);
374 EXPECT_CALL(*mock_input_manager, stop()).Times(1);375 EXPECT_CALL(*mock_input_manager, stop()).Times(1);
375 EXPECT_CALL(*mock_connector, stop()).Times(1);
376 EXPECT_CALL(*mock_compositor, stop()).Times(1);376 EXPECT_CALL(*mock_compositor, stop()).Times(1);
377 EXPECT_CALL(*mock_display, pause()).Times(1);377 EXPECT_CALL(*mock_display, pause()).Times(1);
378 }378 }
@@ -381,16 +381,16 @@
381 {381 {
382 EXPECT_CALL(*mock_display, resume()).Times(1);382 EXPECT_CALL(*mock_display, resume()).Times(1);
383 EXPECT_CALL(*mock_compositor, start()).Times(1);383 EXPECT_CALL(*mock_compositor, start()).Times(1);
384 EXPECT_CALL(*mock_connector, start()).Times(1);
385 EXPECT_CALL(*mock_input_manager, start()).Times(1);384 EXPECT_CALL(*mock_input_manager, start()).Times(1);
386 EXPECT_CALL(*mock_input_dispatcher, start()).Times(1);385 EXPECT_CALL(*mock_input_dispatcher, start()).Times(1);
386 EXPECT_CALL(*mock_connector, start()).Times(1);
387 }387 }
388388
389 void expect_stop()389 void expect_stop()
390 {390 {
391 EXPECT_CALL(*mock_connector, stop()).Times(1);
391 EXPECT_CALL(*mock_input_dispatcher, stop()).Times(1);392 EXPECT_CALL(*mock_input_dispatcher, stop()).Times(1);
392 EXPECT_CALL(*mock_input_manager, stop()).Times(1);393 EXPECT_CALL(*mock_input_manager, stop()).Times(1);
393 EXPECT_CALL(*mock_connector, stop()).Times(1);
394 EXPECT_CALL(*mock_compositor, stop()).Times(1);394 EXPECT_CALL(*mock_compositor, stop()).Times(1);
395 }395 }
396396
@@ -504,18 +504,18 @@
504 expect_start();504 expect_start();
505505
506 /* Pause failure */506 /* Pause failure */
507 EXPECT_CALL(*mock_connector, stop()).Times(1);
507 EXPECT_CALL(*mock_input_dispatcher, stop()).Times(1);508 EXPECT_CALL(*mock_input_dispatcher, stop()).Times(1);
508 EXPECT_CALL(*mock_input_manager, stop()).Times(1);509 EXPECT_CALL(*mock_input_manager, stop()).Times(1);
509 EXPECT_CALL(*mock_connector, stop()).Times(1);
510 EXPECT_CALL(*mock_compositor, stop()).Times(1);510 EXPECT_CALL(*mock_compositor, stop()).Times(1);
511 EXPECT_CALL(*mock_display, pause())511 EXPECT_CALL(*mock_display, pause())
512 .WillOnce(Throw(std::runtime_error("")));512 .WillOnce(Throw(std::runtime_error("")));
513513
514 /* Attempt to continue */514 /* Attempt to continue */
515 EXPECT_CALL(*mock_compositor, start()).Times(1);515 EXPECT_CALL(*mock_compositor, start()).Times(1);
516 EXPECT_CALL(*mock_connector, start()).Times(1);
517 EXPECT_CALL(*mock_input_manager, start()).Times(1);516 EXPECT_CALL(*mock_input_manager, start()).Times(1);
518 EXPECT_CALL(*mock_input_dispatcher, start()).Times(1);517 EXPECT_CALL(*mock_input_dispatcher, start()).Times(1);
518 EXPECT_CALL(*mock_connector, start()).Times(1);
519519
520 expect_stop();520 expect_stop();
521 }521 }

Subscribers

People subscribed via source and target branches