Merge lp:~robertcarr/mir/socket-messenger-reporting into lp:mir
- socket-messenger-reporting
- Merge into development-branch
Status: | Superseded |
---|---|
Proposed branch: | lp:~robertcarr/mir/socket-messenger-reporting |
Merge into: | lp:mir |
Diff against target: |
573 lines (+279/-13) 17 files modified
debian/changelog (+8/-2) include/server/mir/default_server_configuration.h (+3/-0) include/server/mir/frontend/connector_report.h (+0/-1) include/server/mir/frontend/messenger_report.h (+49/-0) include/server/mir/frontend/protobuf_ipc_factory.h (+3/-1) include/server/mir/logging/messenger_report.h (+49/-0) include/test/mir_test_doubles/stub_ipc_factory.h (+6/-1) src/server/default_server_configuration.cpp (+31/-3) src/server/frontend/CMakeLists.txt (+1/-0) src/server/frontend/null_messenger_report.cpp (+25/-0) src/server/frontend/protobuf_session_creator.cpp (+2/-2) src/server/frontend/socket_messenger.cpp (+11/-2) src/server/frontend/socket_messenger.h (+6/-1) src/server/logging/CMakeLists.txt (+1/-0) src/server/logging/messenger_report.cpp (+46/-0) tests/unit-tests/frontend/CMakeLists.txt (+1/-0) tests/unit-tests/frontend/test_socket_messenger.cpp (+37/-0) |
To merge this branch: | bzr merge lp:~robertcarr/mir/socket-messenger-reporting |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Alan Griffiths | Needs Fixing | ||
Daniel van Vugt | Pending | ||
Review via email: mp+187822@code.launchpad.net |
This proposal supersedes a proposal from 2013-09-23.
This proposal has been superseded by a proposal from 2013-09-26.
Commit message
Add messenger report and report socket messenger write errors.
Description of the change
Report socket messenger write errors so we can keep track of this.
Alan Griffiths (alan-griffiths) wrote : Posted in a previous version of this proposal | # |
Robert Carr (robertcarr) wrote : Posted in a previous version of this proposal | # |
Fixed to use the error code, updating to trunk with the reorganization of some frontend interfaces (notably communicator_
Robert Carr (robertcarr) wrote : | # |
Branch confusion....
Alan Griffiths (alan-griffiths) wrote : | # |
418 + if (!err)
Sorry, my typo - there should be no "!"! (Shouldn't a test detect this is wrong?)
And what is the deal with debian/changelog?
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1076
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 1077. By Robert Carr
-
Merge development branch
Unmerged revisions
- 1077. By Robert Carr
-
Merge development branch
- 1076. By Robert Carr
-
Update tests
- 1075. By Robert Carr
-
Merge trunk and update to new frontend interfaces
- 1074. By Robert Carr
-
Typo
- 1073. By Robert Carr
-
socket_messenger: Report exceptions
- 1072. By Daniel van Vugt
-
Stop asio::write from throwing exceptions (SIGPIPE). It will only do so
after we've closed the socket, at which point we don't really care.
(LP: #1226139)
Preview Diff
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2013-09-26 02:41:07 +0000 | |||
3 | +++ debian/changelog 2013-09-26 19:15:16 +0000 | |||
4 | @@ -1,4 +1,4 @@ | |||
6 | 1 | mir (0.0.12-0ubuntu1) UNRELEASED; urgency=low | 1 | mir (0.0.12+13.10.20130926.1-0ubuntu1) saucy; urgency=low |
7 | 2 | 2 | ||
8 | 3 | [ kg ] | 3 | [ kg ] |
9 | 4 | * bump version for ABI break (LP: #1229212) | 4 | * bump version for ABI break (LP: #1229212) |
10 | @@ -6,7 +6,13 @@ | |||
11 | 6 | [ Robert Ancell ] | 6 | [ Robert Ancell ] |
12 | 7 | * Bump version to 0.0.12 | 7 | * Bump version to 0.0.12 |
13 | 8 | 8 | ||
15 | 9 | -- Robert Ancell <robert.ancell@canonical.com> Thu, 26 Sep 2013 09:34:23 +1200 | 9 | [ Alexandros Frantzis ] |
16 | 10 | * tests: Fix compiler warning about maybe-uninitialized struct member | ||
17 | 11 | |||
18 | 12 | [ Ubuntu daily release ] | ||
19 | 13 | * Automatic snapshot from revision 1084 | ||
20 | 14 | |||
21 | 15 | -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Thu, 26 Sep 2013 08:39:29 +0000 | ||
22 | 10 | 16 | ||
23 | 11 | mir (0.0.11+13.10.20130924.1-0ubuntu1) saucy; urgency=low | 17 | mir (0.0.11+13.10.20130924.1-0ubuntu1) saucy; urgency=low |
24 | 12 | 18 | ||
25 | 13 | 19 | ||
26 | === modified file 'include/server/mir/default_server_configuration.h' | |||
27 | --- include/server/mir/default_server_configuration.h 2013-09-24 11:43:27 +0000 | |||
28 | +++ include/server/mir/default_server_configuration.h 2013-09-26 19:15:16 +0000 | |||
29 | @@ -46,6 +46,7 @@ | |||
30 | 46 | class SessionCreator; | 46 | class SessionCreator; |
31 | 47 | class SessionMediatorReport; | 47 | class SessionMediatorReport; |
32 | 48 | class MessageProcessorReport; | 48 | class MessageProcessorReport; |
33 | 49 | class MessengerReport; | ||
34 | 49 | class SessionAuthorizer; | 50 | class SessionAuthorizer; |
35 | 50 | class EventSink; | 51 | class EventSink; |
36 | 51 | class DisplayChanger; | 52 | class DisplayChanger; |
37 | @@ -165,6 +166,7 @@ | |||
38 | 165 | * @{ */ | 166 | * @{ */ |
39 | 166 | virtual std::shared_ptr<frontend::SessionMediatorReport> the_session_mediator_report(); | 167 | virtual std::shared_ptr<frontend::SessionMediatorReport> the_session_mediator_report(); |
40 | 167 | virtual std::shared_ptr<frontend::MessageProcessorReport> the_message_processor_report(); | 168 | virtual std::shared_ptr<frontend::MessageProcessorReport> the_message_processor_report(); |
41 | 169 | virtual std::shared_ptr<frontend::MessengerReport> the_messenger_report(); | ||
42 | 168 | virtual std::shared_ptr<frontend::SessionAuthorizer> the_session_authorizer(); | 170 | virtual std::shared_ptr<frontend::SessionAuthorizer> the_session_authorizer(); |
43 | 169 | virtual std::shared_ptr<frontend::Shell> the_frontend_shell(); | 171 | virtual std::shared_ptr<frontend::Shell> the_frontend_shell(); |
44 | 170 | virtual std::shared_ptr<frontend::EventSink> the_global_event_sink(); | 172 | virtual std::shared_ptr<frontend::EventSink> the_global_event_sink(); |
45 | @@ -270,6 +272,7 @@ | |||
46 | 270 | CachedPtr<frontend::ProtobufIpcFactory> ipc_factory; | 272 | CachedPtr<frontend::ProtobufIpcFactory> ipc_factory; |
47 | 271 | CachedPtr<frontend::SessionMediatorReport> session_mediator_report; | 273 | CachedPtr<frontend::SessionMediatorReport> session_mediator_report; |
48 | 272 | CachedPtr<frontend::MessageProcessorReport> message_processor_report; | 274 | CachedPtr<frontend::MessageProcessorReport> message_processor_report; |
49 | 275 | CachedPtr<frontend::MessengerReport> messenger_report; | ||
50 | 273 | CachedPtr<frontend::SessionAuthorizer> session_authorizer; | 276 | CachedPtr<frontend::SessionAuthorizer> session_authorizer; |
51 | 274 | CachedPtr<frontend::EventSink> global_event_sink; | 277 | CachedPtr<frontend::EventSink> global_event_sink; |
52 | 275 | CachedPtr<frontend::SessionCreator> session_creator; | 278 | CachedPtr<frontend::SessionCreator> session_creator; |
53 | 276 | 279 | ||
54 | === modified file 'include/server/mir/frontend/connector_report.h' | |||
55 | --- include/server/mir/frontend/connector_report.h 2013-09-24 16:20:17 +0000 | |||
56 | +++ include/server/mir/frontend/connector_report.h 2013-09-26 19:15:16 +0000 | |||
57 | @@ -42,7 +42,6 @@ | |||
58 | 42 | class NullConnectorReport : public ConnectorReport | 42 | class NullConnectorReport : public ConnectorReport |
59 | 43 | { | 43 | { |
60 | 44 | public: | 44 | public: |
61 | 45 | |||
62 | 46 | void error(std::exception const& error); | 45 | void error(std::exception const& error); |
63 | 47 | }; | 46 | }; |
64 | 48 | } | 47 | } |
65 | 49 | 48 | ||
66 | === added file 'include/server/mir/frontend/messenger_report.h' | |||
67 | --- include/server/mir/frontend/messenger_report.h 1970-01-01 00:00:00 +0000 | |||
68 | +++ include/server/mir/frontend/messenger_report.h 2013-09-26 19:15:16 +0000 | |||
69 | @@ -0,0 +1,49 @@ | |||
70 | 1 | /* | ||
71 | 2 | * Copyright © 2013 Canonical Ltd. | ||
72 | 3 | * | ||
73 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
74 | 5 | * under the terms of the GNU General Public License version 3, | ||
75 | 6 | * as published by the Free Software Foundation. | ||
76 | 7 | * | ||
77 | 8 | * This program is distributed in the hope that it will be useful, | ||
78 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
79 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
80 | 11 | * GNU General Public License for more details. | ||
81 | 12 | * | ||
82 | 13 | * You should have received a copy of the GNU General Public License | ||
83 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
84 | 15 | * | ||
85 | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> | ||
86 | 17 | */ | ||
87 | 18 | |||
88 | 19 | #ifndef MIR_FRONTEND_MESSENGER_REPORT_H_ | ||
89 | 20 | #define MIR_FRONTEND_MESSENGER_REPORT_H_ | ||
90 | 21 | |||
91 | 22 | #include <string> | ||
92 | 23 | |||
93 | 24 | namespace mir | ||
94 | 25 | { | ||
95 | 26 | namespace frontend | ||
96 | 27 | { | ||
97 | 28 | |||
98 | 29 | class MessengerReport | ||
99 | 30 | { | ||
100 | 31 | public: | ||
101 | 32 | virtual void error(std::string const& error_message) = 0; | ||
102 | 33 | |||
103 | 34 | protected: | ||
104 | 35 | virtual ~MessengerReport() = default; | ||
105 | 36 | MessengerReport() = default; | ||
106 | 37 | MessengerReport(const MessengerReport&) = delete; | ||
107 | 38 | MessengerReport& operator=(const MessengerReport&) = delete; | ||
108 | 39 | }; | ||
109 | 40 | |||
110 | 41 | class NullMessengerReport : public MessengerReport | ||
111 | 42 | { | ||
112 | 43 | public: | ||
113 | 44 | void error(std::string const& error_message); | ||
114 | 45 | }; | ||
115 | 46 | } | ||
116 | 47 | } | ||
117 | 48 | |||
118 | 49 | #endif // MIR_FRONTEND_MESSENGER_REPORT_H_ | ||
119 | 0 | 50 | ||
120 | === modified file 'include/server/mir/frontend/protobuf_ipc_factory.h' | |||
121 | --- include/server/mir/frontend/protobuf_ipc_factory.h 2013-08-28 03:41:48 +0000 | |||
122 | +++ include/server/mir/frontend/protobuf_ipc_factory.h 2013-09-26 19:15:16 +0000 | |||
123 | @@ -32,6 +32,7 @@ | |||
124 | 32 | class EventSink; | 32 | class EventSink; |
125 | 33 | class ResourceCache; | 33 | class ResourceCache; |
126 | 34 | class MessageProcessorReport; | 34 | class MessageProcessorReport; |
127 | 35 | class MessengerReport; | ||
128 | 35 | 36 | ||
129 | 36 | class ProtobufIpcFactory | 37 | class ProtobufIpcFactory |
130 | 37 | { | 38 | { |
131 | @@ -39,7 +40,8 @@ | |||
132 | 39 | virtual std::shared_ptr<protobuf::DisplayServer> make_ipc_server( | 40 | virtual std::shared_ptr<protobuf::DisplayServer> make_ipc_server( |
133 | 40 | std::shared_ptr<EventSink> const& sink, bool authorized_to_resize_display) = 0; | 41 | std::shared_ptr<EventSink> const& sink, bool authorized_to_resize_display) = 0; |
134 | 41 | virtual std::shared_ptr<ResourceCache> resource_cache() = 0; | 42 | virtual std::shared_ptr<ResourceCache> resource_cache() = 0; |
136 | 42 | virtual std::shared_ptr<MessageProcessorReport> report() = 0; | 43 | virtual std::shared_ptr<MessageProcessorReport> message_processor_report() = 0; |
137 | 44 | virtual std::shared_ptr<MessengerReport> messenger_report() = 0; | ||
138 | 43 | 45 | ||
139 | 44 | protected: | 46 | protected: |
140 | 45 | ProtobufIpcFactory() {} | 47 | ProtobufIpcFactory() {} |
141 | 46 | 48 | ||
142 | === added file 'include/server/mir/logging/messenger_report.h' | |||
143 | --- include/server/mir/logging/messenger_report.h 1970-01-01 00:00:00 +0000 | |||
144 | +++ include/server/mir/logging/messenger_report.h 2013-09-26 19:15:16 +0000 | |||
145 | @@ -0,0 +1,49 @@ | |||
146 | 1 | /* | ||
147 | 2 | * Copyright © 2013 Canonical Ltd. | ||
148 | 3 | * | ||
149 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
150 | 5 | * under the terms of the GNU General Public License version 3, | ||
151 | 6 | * as published by the Free Software Foundation. | ||
152 | 7 | * | ||
153 | 8 | * This program is distributed in the hope that it will be useful, | ||
154 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
155 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
156 | 11 | * GNU General Public License for more details. | ||
157 | 12 | * | ||
158 | 13 | * You should have received a copy of the GNU General Public License | ||
159 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
160 | 15 | * | ||
161 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
162 | 17 | */ | ||
163 | 18 | |||
164 | 19 | #ifndef MIR_LOGGING_MESSENGER_REPORT_H_ | ||
165 | 20 | #define MIR_LOGGING_MESSENGER_REPORT_H_ | ||
166 | 21 | |||
167 | 22 | #include "mir/frontend/messenger_report.h" | ||
168 | 23 | |||
169 | 24 | #include <memory> | ||
170 | 25 | |||
171 | 26 | namespace mir | ||
172 | 27 | { | ||
173 | 28 | namespace logging | ||
174 | 29 | { | ||
175 | 30 | class Logger; | ||
176 | 31 | |||
177 | 32 | class MessengerReport : public frontend::MessengerReport | ||
178 | 33 | { | ||
179 | 34 | public: | ||
180 | 35 | MessengerReport(std::shared_ptr<Logger> const& logger); | ||
181 | 36 | virtual ~MessengerReport() noexcept(true) = default; | ||
182 | 37 | |||
183 | 38 | void error(std::string const& error_message); | ||
184 | 39 | |||
185 | 40 | private: | ||
186 | 41 | char const* component(); | ||
187 | 42 | std::shared_ptr<Logger> const logger; | ||
188 | 43 | }; | ||
189 | 44 | |||
190 | 45 | } | ||
191 | 46 | } | ||
192 | 47 | |||
193 | 48 | |||
194 | 49 | #endif /* MIR_LOGGING_MESSENGER_REPORT_H_ */ | ||
195 | 0 | 50 | ||
196 | === modified file 'include/test/mir_test_doubles/stub_ipc_factory.h' | |||
197 | --- include/test/mir_test_doubles/stub_ipc_factory.h 2013-08-28 03:41:48 +0000 | |||
198 | +++ include/test/mir_test_doubles/stub_ipc_factory.h 2013-09-26 19:15:16 +0000 | |||
199 | @@ -24,6 +24,7 @@ | |||
200 | 24 | #include "mir/frontend/protobuf_ipc_factory.h" | 24 | #include "mir/frontend/protobuf_ipc_factory.h" |
201 | 25 | #include "mir/frontend/resource_cache.h" | 25 | #include "mir/frontend/resource_cache.h" |
202 | 26 | #include "mir/frontend/null_message_processor_report.h" | 26 | #include "mir/frontend/null_message_processor_report.h" |
203 | 27 | #include "mir/frontend/messenger_report.h" | ||
204 | 27 | 28 | ||
205 | 28 | namespace mir | 29 | namespace mir |
206 | 29 | { | 30 | { |
207 | @@ -53,10 +54,14 @@ | |||
208 | 53 | return cache; | 54 | return cache; |
209 | 54 | } | 55 | } |
210 | 55 | 56 | ||
212 | 56 | virtual std::shared_ptr<frontend::MessageProcessorReport> report() | 57 | virtual std::shared_ptr<frontend::MessageProcessorReport> message_processor_report() |
213 | 57 | { | 58 | { |
214 | 58 | return std::make_shared<frontend::NullMessageProcessorReport>(); | 59 | return std::make_shared<frontend::NullMessageProcessorReport>(); |
215 | 59 | } | 60 | } |
216 | 61 | virtual std::shared_ptr<frontend::MessengerReport> messenger_report() | ||
217 | 62 | { | ||
218 | 63 | return std::make_shared<frontend::NullMessengerReport>(); | ||
219 | 64 | } | ||
220 | 60 | 65 | ||
221 | 61 | std::shared_ptr<protobuf::DisplayServer> server; | 66 | std::shared_ptr<protobuf::DisplayServer> server; |
222 | 62 | std::shared_ptr<frontend::ResourceCache> const cache; | 67 | std::shared_ptr<frontend::ResourceCache> const cache; |
223 | 63 | 68 | ||
224 | === modified file 'src/server/default_server_configuration.cpp' | |||
225 | --- src/server/default_server_configuration.cpp 2013-09-24 17:25:47 +0000 | |||
226 | +++ src/server/default_server_configuration.cpp 2013-09-26 19:15:16 +0000 | |||
227 | @@ -30,6 +30,7 @@ | |||
228 | 30 | #include "mir/frontend/protobuf_ipc_factory.h" | 30 | #include "mir/frontend/protobuf_ipc_factory.h" |
229 | 31 | #include "mir/frontend/session_mediator_report.h" | 31 | #include "mir/frontend/session_mediator_report.h" |
230 | 32 | #include "mir/frontend/null_message_processor_report.h" | 32 | #include "mir/frontend/null_message_processor_report.h" |
231 | 33 | #include "mir/frontend/messenger_report.h" | ||
232 | 33 | #include "mir/frontend/session_mediator.h" | 34 | #include "mir/frontend/session_mediator.h" |
233 | 34 | #include "mir/frontend/session_authorizer.h" | 35 | #include "mir/frontend/session_authorizer.h" |
234 | 35 | #include "mir/frontend/global_event_sender.h" | 36 | #include "mir/frontend/global_event_sender.h" |
235 | @@ -75,6 +76,7 @@ | |||
236 | 75 | #include "mir/logging/session_mediator_report.h" | 76 | #include "mir/logging/session_mediator_report.h" |
237 | 76 | #include "mir/logging/message_processor_report.h" | 77 | #include "mir/logging/message_processor_report.h" |
238 | 77 | #include "mir/logging/display_report.h" | 78 | #include "mir/logging/display_report.h" |
239 | 79 | #include "mir/logging/messenger_report.h" | ||
240 | 78 | #include "mir/lttng/message_processor_report.h" | 80 | #include "mir/lttng/message_processor_report.h" |
241 | 79 | #include "mir/lttng/input_report.h" | 81 | #include "mir/lttng/input_report.h" |
242 | 80 | #include "mir/shell/surface_source.h" | 82 | #include "mir/shell/surface_source.h" |
243 | @@ -113,13 +115,15 @@ | |||
244 | 113 | explicit DefaultIpcFactory( | 115 | explicit DefaultIpcFactory( |
245 | 114 | std::shared_ptr<mf::Shell> const& shell, | 116 | std::shared_ptr<mf::Shell> const& shell, |
246 | 115 | std::shared_ptr<mf::SessionMediatorReport> const& sm_report, | 117 | std::shared_ptr<mf::SessionMediatorReport> const& sm_report, |
248 | 116 | std::shared_ptr<mf::MessageProcessorReport> const& mr_report, | 118 | std::shared_ptr<mf::MessageProcessorReport> const& mp_report, |
249 | 119 | std::shared_ptr<mf::MessengerReport> const& messenger_report, | ||
250 | 117 | std::shared_ptr<mg::Platform> const& graphics_platform, | 120 | std::shared_ptr<mg::Platform> const& graphics_platform, |
251 | 118 | std::shared_ptr<mf::DisplayChanger> const& display_changer, | 121 | std::shared_ptr<mf::DisplayChanger> const& display_changer, |
252 | 119 | std::shared_ptr<mg::GraphicBufferAllocator> const& buffer_allocator) : | 122 | std::shared_ptr<mg::GraphicBufferAllocator> const& buffer_allocator) : |
253 | 120 | shell(shell), | 123 | shell(shell), |
254 | 121 | sm_report(sm_report), | 124 | sm_report(sm_report), |
256 | 122 | mp_report(mr_report), | 125 | mp_report(mp_report), |
257 | 126 | msger_report(messenger_report), | ||
258 | 123 | cache(std::make_shared<mf::ResourceCache>()), | 127 | cache(std::make_shared<mf::ResourceCache>()), |
259 | 124 | graphics_platform(graphics_platform), | 128 | graphics_platform(graphics_platform), |
260 | 125 | display_changer(display_changer), | 129 | display_changer(display_changer), |
261 | @@ -131,6 +135,7 @@ | |||
262 | 131 | std::shared_ptr<mf::Shell> shell; | 135 | std::shared_ptr<mf::Shell> shell; |
263 | 132 | std::shared_ptr<mf::SessionMediatorReport> const sm_report; | 136 | std::shared_ptr<mf::SessionMediatorReport> const sm_report; |
264 | 133 | std::shared_ptr<mf::MessageProcessorReport> const mp_report; | 137 | std::shared_ptr<mf::MessageProcessorReport> const mp_report; |
265 | 138 | std::shared_ptr<mf::MessengerReport> const msger_report; | ||
266 | 134 | std::shared_ptr<mf::ResourceCache> const cache; | 139 | std::shared_ptr<mf::ResourceCache> const cache; |
267 | 135 | std::shared_ptr<mg::Platform> const graphics_platform; | 140 | std::shared_ptr<mg::Platform> const graphics_platform; |
268 | 136 | std::shared_ptr<mf::DisplayChanger> const display_changer; | 141 | std::shared_ptr<mf::DisplayChanger> const display_changer; |
269 | @@ -164,16 +169,21 @@ | |||
270 | 164 | return cache; | 169 | return cache; |
271 | 165 | } | 170 | } |
272 | 166 | 171 | ||
274 | 167 | virtual std::shared_ptr<mf::MessageProcessorReport> report() | 172 | virtual std::shared_ptr<mf::MessageProcessorReport> message_processor_report() |
275 | 168 | { | 173 | { |
276 | 169 | return mp_report; | 174 | return mp_report; |
277 | 170 | } | 175 | } |
278 | 176 | virtual std::shared_ptr<mf::MessengerReport> messenger_report() | ||
279 | 177 | { | ||
280 | 178 | return msger_report; | ||
281 | 179 | } | ||
282 | 171 | }; | 180 | }; |
283 | 172 | 181 | ||
284 | 173 | char const* const server_socket_opt = "file"; | 182 | char const* const server_socket_opt = "file"; |
285 | 174 | char const* const no_server_socket_opt = "no-file"; | 183 | char const* const no_server_socket_opt = "no-file"; |
286 | 175 | char const* const session_mediator_report_opt = "session-mediator-report"; | 184 | char const* const session_mediator_report_opt = "session-mediator-report"; |
287 | 176 | char const* const msg_processor_report_opt = "msg-processor-report"; | 185 | char const* const msg_processor_report_opt = "msg-processor-report"; |
288 | 186 | char const* const messenger_report_opt = "messenger-report"; | ||
289 | 177 | char const* const display_report_opt = "display-report"; | 187 | char const* const display_report_opt = "display-report"; |
290 | 178 | char const* const legacy_input_report_opt = "legacy-input-report"; | 188 | char const* const legacy_input_report_opt = "legacy-input-report"; |
291 | 179 | char const* const input_report_opt = "input-report"; | 189 | char const* const input_report_opt = "input-report"; |
292 | @@ -824,6 +834,7 @@ | |||
293 | 824 | shell, | 834 | shell, |
294 | 825 | the_session_mediator_report(), | 835 | the_session_mediator_report(), |
295 | 826 | the_message_processor_report(), | 836 | the_message_processor_report(), |
296 | 837 | the_messenger_report(), | ||
297 | 827 | the_graphics_platform(), | 838 | the_graphics_platform(), |
298 | 828 | the_frontend_display_changer(), allocator); | 839 | the_frontend_display_changer(), allocator); |
299 | 829 | }); | 840 | }); |
300 | @@ -890,6 +901,23 @@ | |||
301 | 890 | }); | 901 | }); |
302 | 891 | } | 902 | } |
303 | 892 | 903 | ||
304 | 904 | std::shared_ptr<mf::MessengerReport> | ||
305 | 905 | mir::DefaultServerConfiguration::the_messenger_report() | ||
306 | 906 | { | ||
307 | 907 | return messenger_report( | ||
308 | 908 | [this]() -> std::shared_ptr<mf::MessengerReport> | ||
309 | 909 | { | ||
310 | 910 | auto report_opt = the_options()->get(messenger_report_opt, off_opt_value); | ||
311 | 911 | if (report_opt == log_opt_value) | ||
312 | 912 | { | ||
313 | 913 | return std::make_shared<ml::MessengerReport>(the_logger()); | ||
314 | 914 | } | ||
315 | 915 | else | ||
316 | 916 | { | ||
317 | 917 | return std::make_shared<mf::NullMessengerReport>(); | ||
318 | 918 | } | ||
319 | 919 | }); | ||
320 | 920 | } | ||
321 | 893 | 921 | ||
322 | 894 | std::shared_ptr<ml::Logger> mir::DefaultServerConfiguration::the_logger() | 922 | std::shared_ptr<ml::Logger> mir::DefaultServerConfiguration::the_logger() |
323 | 895 | { | 923 | { |
324 | 896 | 924 | ||
325 | === modified file 'src/server/frontend/CMakeLists.txt' | |||
326 | --- src/server/frontend/CMakeLists.txt 2013-09-24 13:27:33 +0000 | |||
327 | +++ src/server/frontend/CMakeLists.txt 2013-09-26 19:15:16 +0000 | |||
328 | @@ -5,6 +5,7 @@ | |||
329 | 5 | session_mediator.cpp | 5 | session_mediator.cpp |
330 | 6 | null_session_mediator_report.cpp | 6 | null_session_mediator_report.cpp |
331 | 7 | null_message_processor_report.cpp | 7 | null_message_processor_report.cpp |
332 | 8 | null_messenger_report.cpp | ||
333 | 8 | protobuf_message_processor.cpp | 9 | protobuf_message_processor.cpp |
334 | 9 | protobuf_buffer_packer.cpp | 10 | protobuf_buffer_packer.cpp |
335 | 10 | null_message_processor.cpp | 11 | null_message_processor.cpp |
336 | 11 | 12 | ||
337 | === added file 'src/server/frontend/null_messenger_report.cpp' | |||
338 | --- src/server/frontend/null_messenger_report.cpp 1970-01-01 00:00:00 +0000 | |||
339 | +++ src/server/frontend/null_messenger_report.cpp 2013-09-26 19:15:16 +0000 | |||
340 | @@ -0,0 +1,25 @@ | |||
341 | 1 | /* | ||
342 | 2 | * Copyright © 2013 Canonical Ltd. | ||
343 | 3 | * | ||
344 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
345 | 5 | * under the terms of the GNU General Public License version 3, | ||
346 | 6 | * as published by the Free Software Foundation. | ||
347 | 7 | * | ||
348 | 8 | * This program is distributed in the hope that it will be useful, | ||
349 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
350 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
351 | 11 | * GNU General Public License for more details. | ||
352 | 12 | * | ||
353 | 13 | * You should have received a copy of the GNU General Public License | ||
354 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
355 | 15 | * | ||
356 | 16 | * Authored by: Robert Carr <robert.carr@canonical.com> | ||
357 | 17 | */ | ||
358 | 18 | |||
359 | 19 | #include "mir/frontend/messenger_report.h" | ||
360 | 20 | |||
361 | 21 | namespace mf = mir::frontend; | ||
362 | 22 | |||
363 | 23 | void mf::NullMessengerReport::error(std::string const&) | ||
364 | 24 | { | ||
365 | 25 | } | ||
366 | 0 | 26 | ||
367 | === modified file 'src/server/frontend/protobuf_session_creator.cpp' | |||
368 | --- src/server/frontend/protobuf_session_creator.cpp 2013-09-24 13:27:33 +0000 | |||
369 | +++ src/server/frontend/protobuf_session_creator.cpp 2013-09-26 19:15:16 +0000 | |||
370 | @@ -53,7 +53,7 @@ | |||
371 | 53 | 53 | ||
372 | 54 | void mf::ProtobufSessionCreator::create_session_for(std::shared_ptr<ba::local::stream_protocol::socket> const& socket) | 54 | void mf::ProtobufSessionCreator::create_session_for(std::shared_ptr<ba::local::stream_protocol::socket> const& socket) |
373 | 55 | { | 55 | { |
375 | 56 | auto const messenger = std::make_shared<detail::SocketMessenger>(socket); | 56 | auto const messenger = std::make_shared<detail::SocketMessenger>(socket, ipc_factory->messenger_report()); |
376 | 57 | auto const client_pid = messenger->client_pid(); | 57 | auto const client_pid = messenger->client_pid(); |
377 | 58 | 58 | ||
378 | 59 | if (session_authorizer->connection_is_allowed(client_pid)) | 59 | if (session_authorizer->connection_is_allowed(client_pid)) |
379 | @@ -64,7 +64,7 @@ | |||
380 | 64 | messenger, | 64 | messenger, |
381 | 65 | ipc_factory->make_ipc_server(event_sink, authorized_to_resize_display), | 65 | ipc_factory->make_ipc_server(event_sink, authorized_to_resize_display), |
382 | 66 | ipc_factory->resource_cache(), | 66 | ipc_factory->resource_cache(), |
384 | 67 | ipc_factory->report()); | 67 | ipc_factory->message_processor_report()); |
385 | 68 | 68 | ||
386 | 69 | const auto& session = std::make_shared<mfd::SocketSession>(messenger, next_id(), connected_sessions, msg_processor); | 69 | const auto& session = std::make_shared<mfd::SocketSession>(messenger, next_id(), connected_sessions, msg_processor); |
387 | 70 | connected_sessions->add(session); | 70 | connected_sessions->add(session); |
388 | 71 | 71 | ||
389 | === modified file 'src/server/frontend/socket_messenger.cpp' | |||
390 | --- src/server/frontend/socket_messenger.cpp 2013-09-25 14:18:18 +0000 | |||
391 | +++ src/server/frontend/socket_messenger.cpp 2013-09-26 19:15:16 +0000 | |||
392 | @@ -18,13 +18,16 @@ | |||
393 | 18 | 18 | ||
394 | 19 | #include "socket_messenger.h" | 19 | #include "socket_messenger.h" |
395 | 20 | #include "mir/frontend/client_constants.h" | 20 | #include "mir/frontend/client_constants.h" |
396 | 21 | #include "mir/frontend/messenger_report.h" | ||
397 | 21 | 22 | ||
398 | 22 | namespace mfd = mir::frontend::detail; | 23 | namespace mfd = mir::frontend::detail; |
399 | 23 | namespace bs = boost::system; | 24 | namespace bs = boost::system; |
400 | 24 | namespace ba = boost::asio; | 25 | namespace ba = boost::asio; |
401 | 25 | 26 | ||
404 | 26 | mfd::SocketMessenger::SocketMessenger(std::shared_ptr<ba::local::stream_protocol::socket> const& socket) | 27 | mfd::SocketMessenger::SocketMessenger(std::shared_ptr<ba::local::stream_protocol::socket> const& socket, |
405 | 27 | : socket(socket) | 28 | std::shared_ptr<MessengerReport> const& report) |
406 | 29 | : socket(socket), | ||
407 | 30 | report(report) | ||
408 | 28 | { | 31 | { |
409 | 29 | whole_message.reserve(serialization_buffer_size); | 32 | whole_message.reserve(serialization_buffer_size); |
410 | 30 | } | 33 | } |
411 | @@ -59,8 +62,14 @@ | |||
412 | 59 | // function has completed (if it would be executed asynchronously. | 62 | // function has completed (if it would be executed asynchronously. |
413 | 60 | // NOTE: we rely on this synchronous behavior as per the comment in | 63 | // NOTE: we rely on this synchronous behavior as per the comment in |
414 | 61 | // mf::SessionMediator::create_surface | 64 | // mf::SessionMediator::create_surface |
415 | 65 | |||
416 | 62 | boost::system::error_code err; | 66 | boost::system::error_code err; |
417 | 63 | ba::write(*socket, ba::buffer(whole_message), err); | 67 | ba::write(*socket, ba::buffer(whole_message), err); |
418 | 68 | if (!err) | ||
419 | 69 | { | ||
420 | 70 | report->error(err.message()); | ||
421 | 71 | } | ||
422 | 72 | |||
423 | 64 | } | 73 | } |
424 | 65 | 74 | ||
425 | 66 | void mfd::SocketMessenger::send_fds(std::vector<int32_t> const& fds) | 75 | void mfd::SocketMessenger::send_fds(std::vector<int32_t> const& fds) |
426 | 67 | 76 | ||
427 | === modified file 'src/server/frontend/socket_messenger.h' | |||
428 | --- src/server/frontend/socket_messenger.h 2013-08-28 03:41:48 +0000 | |||
429 | +++ src/server/frontend/socket_messenger.h 2013-09-26 19:15:16 +0000 | |||
430 | @@ -26,13 +26,16 @@ | |||
431 | 26 | { | 26 | { |
432 | 27 | namespace frontend | 27 | namespace frontend |
433 | 28 | { | 28 | { |
434 | 29 | class MessengerReport; | ||
435 | 30 | |||
436 | 29 | namespace detail | 31 | namespace detail |
437 | 30 | { | 32 | { |
438 | 31 | class SocketMessenger : public MessageSender, | 33 | class SocketMessenger : public MessageSender, |
439 | 32 | public MessageReceiver | 34 | public MessageReceiver |
440 | 33 | { | 35 | { |
441 | 34 | public: | 36 | public: |
443 | 35 | SocketMessenger(std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket); | 37 | SocketMessenger(std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket, |
444 | 38 | std::shared_ptr<frontend::MessengerReport> const& report); | ||
445 | 36 | 39 | ||
446 | 37 | void send(std::string const& body); | 40 | void send(std::string const& body); |
447 | 38 | void send_fds(std::vector<int32_t> const& fds); | 41 | void send_fds(std::vector<int32_t> const& fds); |
448 | @@ -42,6 +45,8 @@ | |||
449 | 42 | 45 | ||
450 | 43 | private: | 46 | private: |
451 | 44 | std::shared_ptr<boost::asio::local::stream_protocol::socket> socket; | 47 | std::shared_ptr<boost::asio::local::stream_protocol::socket> socket; |
452 | 48 | std::shared_ptr<MessengerReport> const report; | ||
453 | 49 | |||
454 | 45 | std::vector<char> whole_message; | 50 | std::vector<char> whole_message; |
455 | 46 | }; | 51 | }; |
456 | 47 | } | 52 | } |
457 | 48 | 53 | ||
458 | === modified file 'src/server/logging/CMakeLists.txt' | |||
459 | --- src/server/logging/CMakeLists.txt 2013-08-28 03:41:48 +0000 | |||
460 | +++ src/server/logging/CMakeLists.txt 2013-09-26 19:15:16 +0000 | |||
461 | @@ -6,6 +6,7 @@ | |||
462 | 6 | message_processor_report.cpp | 6 | message_processor_report.cpp |
463 | 7 | display_report.cpp | 7 | display_report.cpp |
464 | 8 | input_report.cpp | 8 | input_report.cpp |
465 | 9 | messenger_report.cpp | ||
466 | 9 | ) | 10 | ) |
467 | 10 | 11 | ||
468 | 11 | add_library( | 12 | add_library( |
469 | 12 | 13 | ||
470 | === added file 'src/server/logging/messenger_report.cpp' | |||
471 | --- src/server/logging/messenger_report.cpp 1970-01-01 00:00:00 +0000 | |||
472 | +++ src/server/logging/messenger_report.cpp 2013-09-26 19:15:16 +0000 | |||
473 | @@ -0,0 +1,46 @@ | |||
474 | 1 | /* | ||
475 | 2 | * Copyright © 2013 Canonical Ltd. | ||
476 | 3 | * | ||
477 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
478 | 5 | * under the terms of the GNU General Public License version 3, | ||
479 | 6 | * as published by the Free Software Foundation. | ||
480 | 7 | * | ||
481 | 8 | * This program is distributed in the hope that it will be useful, | ||
482 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
483 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
484 | 11 | * GNU General Public License for more details. | ||
485 | 12 | * | ||
486 | 13 | * You should have received a copy of the GNU General Public License | ||
487 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
488 | 15 | * | ||
489 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
490 | 17 | */ | ||
491 | 18 | |||
492 | 19 | #include "mir/logging/messenger_report.h" | ||
493 | 20 | #include "mir/logging/logger.h" | ||
494 | 21 | |||
495 | 22 | #include "std/MirLog.h" | ||
496 | 23 | #include <std/Log.h> | ||
497 | 24 | |||
498 | 25 | |||
499 | 26 | #include <sstream> | ||
500 | 27 | #include <cstring> | ||
501 | 28 | #include <mutex> | ||
502 | 29 | |||
503 | 30 | namespace ml = mir::logging; | ||
504 | 31 | |||
505 | 32 | ml::MessengerReport::MessengerReport(const std::shared_ptr<Logger>& logger) | ||
506 | 33 | : logger(logger) | ||
507 | 34 | { | ||
508 | 35 | } | ||
509 | 36 | |||
510 | 37 | const char* ml::MessengerReport::component() | ||
511 | 38 | { | ||
512 | 39 | static const char* s = "messenger"; | ||
513 | 40 | return s; | ||
514 | 41 | } | ||
515 | 42 | |||
516 | 43 | void ml::MessengerReport::error(std::string const& error_message) | ||
517 | 44 | { | ||
518 | 45 | logger->log<Logger::informational>(error_message, component()); | ||
519 | 46 | } | ||
520 | 0 | 47 | ||
521 | === modified file 'tests/unit-tests/frontend/CMakeLists.txt' | |||
522 | --- tests/unit-tests/frontend/CMakeLists.txt 2013-09-24 14:13:15 +0000 | |||
523 | +++ tests/unit-tests/frontend/CMakeLists.txt 2013-09-26 19:15:16 +0000 | |||
524 | @@ -8,6 +8,7 @@ | |||
525 | 8 | ${CMAKE_CURRENT_SOURCE_DIR}/test_resource_cache.cpp | 8 | ${CMAKE_CURRENT_SOURCE_DIR}/test_resource_cache.cpp |
526 | 9 | ${CMAKE_CURRENT_SOURCE_DIR}/test_session_mediator.cpp | 9 | ${CMAKE_CURRENT_SOURCE_DIR}/test_session_mediator.cpp |
527 | 10 | ${CMAKE_CURRENT_SOURCE_DIR}/test_socket_session.cpp | 10 | ${CMAKE_CURRENT_SOURCE_DIR}/test_socket_session.cpp |
528 | 11 | ${CMAKE_CURRENT_SOURCE_DIR}/test_socket_messenger.cpp | ||
529 | 11 | ${CMAKE_CURRENT_SOURCE_DIR}/test_event_sender.cpp | 12 | ${CMAKE_CURRENT_SOURCE_DIR}/test_event_sender.cpp |
530 | 12 | ${CMAKE_CURRENT_SOURCE_DIR}/test_global_event_sender.cpp | 13 | ${CMAKE_CURRENT_SOURCE_DIR}/test_global_event_sender.cpp |
531 | 13 | ) | 14 | ) |
532 | 14 | 15 | ||
533 | === added file 'tests/unit-tests/frontend/test_socket_messenger.cpp' | |||
534 | --- tests/unit-tests/frontend/test_socket_messenger.cpp 1970-01-01 00:00:00 +0000 | |||
535 | +++ tests/unit-tests/frontend/test_socket_messenger.cpp 2013-09-26 19:15:16 +0000 | |||
536 | @@ -0,0 +1,37 @@ | |||
537 | 1 | /* | ||
538 | 2 | * Copyright © 2013 Canonical Ltd. | ||
539 | 3 | * | ||
540 | 4 | * This program is free software: you can redistribute it and/or modify | ||
541 | 5 | * it under the terms of the GNU General Public License version 3 as | ||
542 | 6 | * published by the Free Software Foundation. | ||
543 | 7 | * | ||
544 | 8 | * This program is distributed in the hope that it will be useful, | ||
545 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
546 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
547 | 11 | * GNU General Public License for more details. | ||
548 | 12 | * | ||
549 | 13 | * You should have received a copy of the GNU General Public License | ||
550 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
551 | 15 | * | ||
552 | 16 | * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com> | ||
553 | 17 | */ | ||
554 | 18 | |||
555 | 19 | #include "mir/frontend/messenger_report.h" | ||
556 | 20 | #include "src/server/frontend/socket_messenger.h" | ||
557 | 21 | |||
558 | 22 | #include <gmock/gmock.h> | ||
559 | 23 | #include <gtest/gtest.h> | ||
560 | 24 | |||
561 | 25 | namespace mf = mir::frontend; | ||
562 | 26 | |||
563 | 27 | using namespace mf::detail; | ||
564 | 28 | using namespace boost::asio; | ||
565 | 29 | |||
566 | 30 | TEST(SocketMessengerTest, write_failures_never_throw) | ||
567 | 31 | { | ||
568 | 32 | io_service svc; | ||
569 | 33 | auto sock = std::make_shared<local::stream_protocol::socket>(svc); | ||
570 | 34 | SocketMessenger mess(sock, std::make_shared<mf::NullMessengerReport>()); | ||
571 | 35 | |||
572 | 36 | EXPECT_NO_THROW( mess.send("foo") ); | ||
573 | 37 | } |
[ try] whole_message) );
9 {
50 ba::write(*socket, ba::buffer(
51 }
52 - catch (std::exception &)
53 + catch (std::exception &ex)
54 {
55 - // Don't care
56 + report->error(ex);
57 }
This is better written as:
boost: :system: :error_ code ec; :write( *socket, ba::buffer( whole_message) , ec);
ba:
if (!ec)
report- >error( ec.message( ));
{
}
And not throwing and catching exceptions.