Mir

Merge lp:~robert-ancell/mir/frontend-class-renaming into lp:~mir-team/mir/trunk

Proposed by Robert Ancell
Status: Rejected
Rejected by: Robert Ancell
Proposed branch: lp:~robert-ancell/mir/frontend-class-renaming
Merge into: lp:~mir-team/mir/trunk
Diff against target: 486 lines (+73/-117)
11 files modified
src/server/frontend/CMakeLists.txt (+3/-4)
src/server/frontend/make_socket_communicator.cpp (+2/-2)
src/server/frontend/message_processor.cpp (+31/-31)
src/server/frontend/message_processor.h (+8/-8)
src/server/frontend/message_sender.h (+9/-25)
src/server/frontend/null_message_processor.cpp (+0/-26)
src/server/frontend/socket_communicator.cpp (+10/-10)
src/server/frontend/socket_communicator.h (+6/-6)
src/server/frontend/socket_session.cpp (+1/-1)
src/server/frontend/socket_session.h (+1/-2)
tests/mir_test_doubles/test_protobuf_socket_server.cpp (+2/-2)
To merge this branch: bzr merge lp:~robert-ancell/mir/frontend-class-renaming
Reviewer Review Type Date Requested Status
Alexandros Frantzis (community) Needs Fixing
Alan Griffiths Needs Fixing
Daniel van Vugt Approve
Kevin DuBois (community) Needs Information
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+156430@code.launchpad.net

Commit message

Refactor frontend code to use simpler and more consistent class naming

Description of the change

Rename some of the classes in the frontend to make it simpler to understand. This is based on my first impression of understanding the frontend code. While I could see the intention to make the transport layer (socket, binder) and protocol (protocol buffers) flexible I found this to confuse the classes and be overly abstracted.

1. Rename ProtobufSocketCommunicator to SocketCommicator

This is because the Protobuf part is confusing
 - It makes the relationship to SocketSession less clear.
 - The Protobuf prefix is not consistently applied, i.e. SessionMediator is also Protobuf dependent but doesn't use the prefix.
 - One prefix (Socket) is simpler than two (ProtobufSocket).

2. Rename ProtobufMessageProcessor to MessageProcessor

This is the last remaining "Protobuf" class so removing it seems ideal.
 - Removed the NullMessageProcessor since it was only used in one place - a simple NULL check replaces it.
 - message_process.h was overloaded with two classes (MessageProcessor and MessageSender) - Move MessageSender to its own header file and just use protobuf_message_processor.h as the new message_processor.h.

The one part that doesn't feel great now is the fact that there is a clear abstraction for MessageSender, but not for MessageProcessor (which is tied to protocol buffers). I didn't have a good name for using MessageProcessor as the interface and ?MessageProcessor as the implementation. We could use SocketMessageProcessor except the message processor is independent from the transport layer.

The use of "Processor" as a name seems a bit vague to me (i.e. most classes are "processing" something). I think it would be better to use names that are clearer inverses e.g. Sender/Receiver, Encoder/Decoder or Serializer/Deserializer.

(The last two points are worth discussing but I don't think need to be solved by this merge).

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 :

i'm going to mark as 'needs information' but what I really mean is 'needs discussion'. I guess if the binder code that drove these abstractions is now gone, it would make sense for the abstractions to be reworked. The only part that I don't like is that we're getting rid of MessageProcessor's interface class, will make it harder to mock.

I guess overall I agree with the reasons and the substance for the changes, but don't see the test scenario that's driving the changes that go beyond the name changes (eg, making process_message public instead of private)

review: Needs Information
Revision history for this message
Kevin DuBois (kdub) wrote :

> I guess overall I agree with the reasons and the substance for the changes,
reasons for, and substance of, the changes

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Looks good to me. Tests are unchanged and coverage should slightly increase with this.

If we need to increase abstraction again later for more mocking, then that's an exercise for later.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

There is a possible argument that "Protobuf" prefixes are appropriate, should anyone want to add support for other protocols later. Though I'm not entirely sure the existing design is sufficient to support a clean replacement of the protocol layer like that. So simpler is better for now.

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

I'm happy with the motivation. Not so happy with some aspects of the proposed changes.

Dependencies should always be on interfaces, not concrete classes - so I think it wrong to conflate MessageProcessor and ProtobufMessageProcessor.

We've a rule in the codebase that we don't have null dependencies (and use null objects instead). I don't think we should be making an exception here just to avoid having a trivial NullMessageProcessor class.

review: Needs Fixing
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It's not a rule; it's a convention. And any convention which results in trivial un(der)used classes should probably be changed, or at least bent. As I said above; "If we need to increase abstraction again later for more mocking, then that's an exercise for later".

I feel that Mir has a growing problem with its code complexity out-pacing functionality. That's a particular concern for our ability to maintain and enhance the code. So any successful attempt to simplify things should surely be welcomed.

Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

> There is a possible argument that "Protobuf" prefixes are appropriate, should anyone want to add support for other protocols later

It's also about descriptive naming. ProtobufSocketCommunicator is a communicator that uses protobuf over sockets, all the important information is in the name.

> The only part that I don't like is that we're getting rid of MessageProcessor's interface class, will make it harder to mock.

> Dependencies should always be on interfaces, not concrete classes - so I think it wrong to conflate MessageProcessor and ProtobufMessageProcessor.

The fact that we can make MessageProcessor concrete without any consequences, tells me that we are missing some tests where the interface is used (in SocketSession, e.g. message_processed_when_new_message_arrives), not that we don't need to have it as an interface.

> > We've a rule in the codebase that we don't have null dependencies (and use null objects instead).
> It's not a rule; it's a convention. And any convention which results in trivial un(der)used classes should probably be changed, or at least bent.

However you call it, the point is that there are reasons for it, we didn't just flip a coin and went with NullObjects. If we turn this around: "any convention which results in the circulation of null smart pointers should probably be changed, or at least bent." :) As with any engineering decision, there are trade-offs involved, and the decision was that NullObject trade-offs are worth it.

review: Needs Fixing
Revision history for this message
Robert Ancell (robert-ancell) wrote :

> We've a rule in the codebase that we don't have null dependencies (and use
> null objects instead). I don't think we should be making an exception here
> just to avoid having a trivial NullMessageProcessor class.

I wasn't aware that is the case, I'll work on fixing that. Can you please add this information to the style guide?

Revision history for this message
Robert Ancell (robert-ancell) wrote :

My motivation for this is gone. I will pick it up later if it returns :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/server/frontend/CMakeLists.txt'
2--- src/server/frontend/CMakeLists.txt 2013-03-28 09:50:09 +0000
3+++ src/server/frontend/CMakeLists.txt 2013-04-01 21:52:22 +0000
4@@ -4,8 +4,7 @@
5 session_mediator.cpp
6 null_session_mediator_report.cpp
7 null_message_processor_report.cpp
8- protobuf_message_processor.cpp
9- null_message_processor.cpp
10+ message_processor.cpp
11 surface_creation_parameters.cpp
12
13 resource_cache.cpp
14@@ -13,8 +12,8 @@
15 )
16
17 list(APPEND FRONTEND_SOURCES
18- protobuf_socket_communicator.cpp
19- make_protobuf_socket_communicator.cpp
20+ socket_communicator.cpp
21+ make_socket_communicator.cpp
22 socket_session.cpp
23 )
24
25
26=== renamed file 'src/server/frontend/make_protobuf_socket_communicator.cpp' => 'src/server/frontend/make_socket_communicator.cpp'
27--- src/server/frontend/make_protobuf_socket_communicator.cpp 2013-03-21 03:32:59 +0000
28+++ src/server/frontend/make_socket_communicator.cpp 2013-04-01 21:52:22 +0000
29@@ -18,7 +18,7 @@
30
31 #include "mir/default_server_configuration.h"
32 #include "mir/options/option.h"
33-#include "protobuf_socket_communicator.h"
34+#include "socket_communicator.h"
35
36 namespace mf = mir::frontend;
37 namespace mg = mir::graphics;
38@@ -31,7 +31,7 @@
39 [&,this]() -> std::shared_ptr<mf::Communicator>
40 {
41 auto const threads = the_options()->get("ipc-thread-pool", 10);
42- return std::make_shared<mf::ProtobufSocketCommunicator>(
43+ return std::make_shared<mf::SocketCommunicator>(
44 the_socket_file(),
45 the_ipc_factory(the_frontend_shell(), the_viewable_area(), the_buffer_allocator()),
46 threads);
47
48=== renamed file 'src/server/frontend/protobuf_message_processor.cpp' => 'src/server/frontend/message_processor.cpp'
49--- src/server/frontend/protobuf_message_processor.cpp 2013-03-22 03:33:00 +0000
50+++ src/server/frontend/message_processor.cpp 2013-04-01 21:52:22 +0000
51@@ -16,7 +16,7 @@
52 * Authored by: Alan Griffiths <alan@octopull.co.uk>
53 */
54
55-#include "protobuf_message_processor.h"
56+#include "message_processor.h"
57 #include "mir/frontend/message_processor_report.h"
58 #include "mir/frontend/resource_cache.h"
59
60@@ -26,7 +26,7 @@
61
62 namespace mfd = mir::frontend::detail;
63
64-mfd::ProtobufMessageProcessor::ProtobufMessageProcessor(
65+mfd::MessageProcessor::MessageProcessor(
66 MessageSender* sender,
67 std::shared_ptr<protobuf::DisplayServer> const& display_server,
68 std::shared_ptr<ResourceCache> const& resource_cache,
69@@ -39,28 +39,28 @@
70 }
71
72 template<class ResultMessage>
73-void mfd::ProtobufMessageProcessor::send_response(::google::protobuf::uint32 id, ResultMessage* response)
74-{
75- send_response(id, static_cast<google::protobuf::Message*>(response));
76-}
77-
78-void mfd::ProtobufMessageProcessor::send_response(::google::protobuf::uint32 id, mir::protobuf::Buffer* response)
79-{
80- const auto& fd = extract_fds_from(response);
81- send_response(id, static_cast<google::protobuf::Message*>(response));
82- sender->send_fds(fd);
83- resource_cache->free_resource(response);
84-}
85-
86-void mfd::ProtobufMessageProcessor::send_response(::google::protobuf::uint32 id, mir::protobuf::Platform* response)
87-{
88- const auto& fd = extract_fds_from(response);
89- send_response(id, static_cast<google::protobuf::Message*>(response));
90- sender->send_fds(fd);
91- resource_cache->free_resource(response);
92-}
93-
94-void mfd::ProtobufMessageProcessor::send_response(::google::protobuf::uint32 id, mir::protobuf::Connection* response)
95+void mfd::MessageProcessor::send_response(::google::protobuf::uint32 id, ResultMessage* response)
96+{
97+ send_response(id, static_cast<google::protobuf::Message*>(response));
98+}
99+
100+void mfd::MessageProcessor::send_response(::google::protobuf::uint32 id, mir::protobuf::Buffer* response)
101+{
102+ const auto& fd = extract_fds_from(response);
103+ send_response(id, static_cast<google::protobuf::Message*>(response));
104+ sender->send_fds(fd);
105+ resource_cache->free_resource(response);
106+}
107+
108+void mfd::MessageProcessor::send_response(::google::protobuf::uint32 id, mir::protobuf::Platform* response)
109+{
110+ const auto& fd = extract_fds_from(response);
111+ send_response(id, static_cast<google::protobuf::Message*>(response));
112+ sender->send_fds(fd);
113+ resource_cache->free_resource(response);
114+}
115+
116+void mfd::MessageProcessor::send_response(::google::protobuf::uint32 id, mir::protobuf::Connection* response)
117 {
118 const auto& fd = response->has_platform() ?
119 extract_fds_from(response->mutable_platform()) :
120@@ -71,7 +71,7 @@
121 resource_cache->free_resource(response);
122 }
123
124-void mfd::ProtobufMessageProcessor::send_response(::google::protobuf::uint32 id, mir::protobuf::Surface* response)
125+void mfd::MessageProcessor::send_response(::google::protobuf::uint32 id, mir::protobuf::Surface* response)
126 {
127 const auto& fd = response->has_buffer() ?
128 extract_fds_from(response->mutable_buffer()) :
129@@ -83,7 +83,7 @@
130 }
131
132 template<class Response>
133-std::vector<int32_t> mfd::ProtobufMessageProcessor::extract_fds_from(Response* response)
134+std::vector<int32_t> mfd::MessageProcessor::extract_fds_from(Response* response)
135 {
136 std::vector<int32_t> fd(response->fd().data(), response->fd().data() + response->fd().size());
137 response->clear_fd();
138@@ -92,7 +92,7 @@
139 }
140
141 template<class ParameterMessage, class ResultMessage>
142-void mfd::ProtobufMessageProcessor::invoke(
143+void mfd::MessageProcessor::invoke(
144 void (protobuf::DisplayServer::*function)(
145 ::google::protobuf::RpcController* controller,
146 const ParameterMessage* request,
147@@ -108,7 +108,7 @@
148 {
149 std::unique_ptr<google::protobuf::Closure> callback(
150 google::protobuf::NewPermanentCallback(this,
151- &ProtobufMessageProcessor::send_response,
152+ &MessageProcessor::send_response,
153 invocation.id(),
154 &result_message));
155
156@@ -125,7 +125,7 @@
157 }
158 }
159
160-void mfd::ProtobufMessageProcessor::send_response(
161+void mfd::MessageProcessor::send_response(
162 ::google::protobuf::uint32 id,
163 google::protobuf::Message* response)
164 {
165@@ -142,7 +142,7 @@
166 sender->send(buffer2);
167 }
168
169-bool mfd::ProtobufMessageProcessor::dispatch(mir::protobuf::wire::Invocation const& invocation)
170+bool mfd::MessageProcessor::dispatch(mir::protobuf::wire::Invocation const& invocation)
171 {
172 report->received_invocation(display_server.get(), invocation.id(), invocation.method_name());
173
174@@ -207,7 +207,7 @@
175 }
176
177
178-bool mfd::ProtobufMessageProcessor::process_message(std::istream& msg)
179+bool mfd::MessageProcessor::process_message(std::istream& msg)
180 {
181 try
182 {
183
184=== renamed file 'src/server/frontend/protobuf_message_processor.h' => 'src/server/frontend/message_processor.h'
185--- src/server/frontend/protobuf_message_processor.h 2013-03-22 03:33:00 +0000
186+++ src/server/frontend/message_processor.h 2013-04-01 21:52:22 +0000
187@@ -17,10 +17,10 @@
188 */
189
190
191-#ifndef MIR_FRONTEND_PROTOBUF_MESSAGE_PROCESSOR_H_
192-#define MIR_FRONTEND_PROTOBUF_MESSAGE_PROCESSOR_H_
193+#ifndef MIR_FRONTEND_MESSAGE_PROCESSOR_H_
194+#define MIR_FRONTEND_MESSAGE_PROCESSOR_H_
195
196-#include "message_processor.h"
197+#include "message_sender.h"
198
199 #include "mir_protobuf.pb.h"
200 #include "mir_protobuf_wire.pb.h"
201@@ -42,14 +42,16 @@
202 namespace detail
203 {
204
205-struct ProtobufMessageProcessor : MessageProcessor
206+struct MessageProcessor
207 {
208- ProtobufMessageProcessor(
209+ MessageProcessor(
210 MessageSender* sender,
211 std::shared_ptr<protobuf::DisplayServer> const& display_server,
212 std::shared_ptr<ResourceCache> const& resource_cache,
213 std::shared_ptr<MessageProcessorReport> const& report);
214
215+ bool process_message(std::istream& msg);
216+
217 private:
218 void send_response(::google::protobuf::uint32 id, google::protobuf::Message* response);
219
220@@ -75,8 +77,6 @@
221 template<class Response>
222 std::vector<int32_t> extract_fds_from(Response* response);
223
224- bool process_message(std::istream& msg);
225-
226 bool dispatch(mir::protobuf::wire::Invocation const& invocation);
227
228 template<class ParameterMessage, class ResultMessage>
229@@ -97,4 +97,4 @@
230 }
231 }
232
233-#endif /* PROTOBUF_MESSAGE_PROCESSOR_H_ */
234+#endif /* MIR_FRONTEND_MESSAGE_PROCESSOR_H_ */
235
236=== renamed file 'src/server/frontend/message_processor.h' => 'src/server/frontend/message_sender.h'
237--- src/server/frontend/message_processor.h 2013-03-13 04:54:15 +0000
238+++ src/server/frontend/message_sender.h 2013-04-01 21:52:22 +0000
239@@ -17,8 +17,8 @@
240 */
241
242
243-#ifndef MIR_FRONTEND_MESSAGE_PROCESSOR_H_
244-#define MIR_FRONTEND_MESSAGE_PROCESSOR_H_
245+#ifndef MIR_FRONTEND_MESSAGE_SENDER_H_
246+#define MIR_FRONTEND_MESSAGE_SENDER_H_
247
248 #include <vector>
249 #include <memory>
250@@ -41,26 +41,10 @@
251 MessageSender(MessageSender const&) = delete;
252 MessageSender& operator=(MessageSender const&) = delete;
253 };
254-
255-struct MessageProcessor
256-{
257- virtual bool process_message(std::istream& msg) = 0;
258-protected:
259- MessageProcessor() = default;
260- ~MessageProcessor() = default;
261- MessageProcessor(MessageProcessor const&) = delete;
262- MessageProcessor& operator=(MessageProcessor const&) = delete;
263-};
264-
265-struct NullMessageProcessor : MessageProcessor
266-{
267- bool process_message(std::istream&);
268-};
269-
270-}
271-}
272-}
273-
274-
275-
276-#endif /* PROTOBUF_MESSAGE_PROCESSOR_H_ */
277+}
278+}
279+}
280+
281+
282+
283+#endif /* MIR_FRONTEND_MESSAGE_SENDER_H_ */
284
285=== removed file 'src/server/frontend/null_message_processor.cpp'
286--- src/server/frontend/null_message_processor.cpp 2013-03-13 04:54:15 +0000
287+++ src/server/frontend/null_message_processor.cpp 1970-01-01 00:00:00 +0000
288@@ -1,26 +0,0 @@
289-/*
290- * Copyright © 2012 Canonical Ltd.
291- *
292- * This program is free software: you can redistribute it and/or modify it
293- * under the terms of the GNU Lesser General Public License version 3,
294- * as published by the Free Software Foundation.
295- *
296- * This program is distributed in the hope that it will be useful,
297- * but WITHOUT ANY WARRANTY; without even the implied warranty of
298- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
299- * GNU General Public License for more details.
300- *
301- * You should have received a copy of the GNU Lesser General Public License
302- * along with this program. If not, see <http://www.gnu.org/licenses/>.
303- *
304- * Authored by: Alan Griffiths <alan@octopull.co.uk>
305- */
306-
307-#include "message_processor.h"
308-
309-namespace mfd = mir::frontend::detail;
310-
311-bool mfd::NullMessageProcessor::process_message(std::istream& )
312-{
313- return false;
314-}
315
316=== renamed file 'src/server/frontend/protobuf_socket_communicator.cpp' => 'src/server/frontend/socket_communicator.cpp'
317--- src/server/frontend/protobuf_socket_communicator.cpp 2013-03-22 03:33:00 +0000
318+++ src/server/frontend/socket_communicator.cpp 2013-04-01 21:52:22 +0000
319@@ -16,8 +16,8 @@
320 * Authored by: Thomas Guest <thomas.guest@canonical.com>
321 */
322
323-#include "protobuf_socket_communicator.h"
324-#include "protobuf_message_processor.h"
325+#include "socket_communicator.h"
326+#include "message_processor.h"
327 #include "socket_session.h"
328
329 #include "mir/frontend/protobuf_ipc_factory.h"
330@@ -31,7 +31,7 @@
331 namespace ba = boost::asio;
332
333
334-mf::ProtobufSocketCommunicator::ProtobufSocketCommunicator(
335+mf::SocketCommunicator::SocketCommunicator(
336 std::string const& socket_file,
337 std::shared_ptr<ProtobufIpcFactory> const& ipc_factory,
338 int threads)
339@@ -45,14 +45,14 @@
340 start_accept();
341 }
342
343-void mf::ProtobufSocketCommunicator::start_accept()
344+void mf::SocketCommunicator::start_accept()
345 {
346 auto const& socket_session = std::make_shared<mfd::SocketSession>(
347 io_service,
348 next_id(),
349 connected_sessions);
350
351- auto session = std::make_shared<detail::ProtobufMessageProcessor>(
352+ auto session = std::make_shared<detail::MessageProcessor>(
353 socket_session.get(),
354 ipc_factory->make_ipc_server(),
355 ipc_factory->resource_cache(),
356@@ -63,13 +63,13 @@
357 acceptor.async_accept(
358 socket_session->get_socket(),
359 boost::bind(
360- &ProtobufSocketCommunicator::on_new_connection,
361+ &SocketCommunicator::on_new_connection,
362 this,
363 socket_session,
364 ba::placeholders::error));
365 }
366
367-int mf::ProtobufSocketCommunicator::next_id()
368+int mf::SocketCommunicator::next_id()
369 {
370 int id = next_session_id.load();
371 while (!next_session_id.compare_exchange_weak(id, id + 1)) std::this_thread::yield();
372@@ -77,7 +77,7 @@
373 }
374
375
376-void mf::ProtobufSocketCommunicator::start()
377+void mf::SocketCommunicator::start()
378 {
379 auto run_io_service = boost::bind(&ba::io_service::run, &io_service);
380
381@@ -87,7 +87,7 @@
382 }
383 }
384
385-mf::ProtobufSocketCommunicator::~ProtobufSocketCommunicator()
386+mf::SocketCommunicator::~SocketCommunicator()
387 {
388 io_service.stop();
389
390@@ -104,7 +104,7 @@
391 std::remove(socket_file.c_str());
392 }
393
394-void mf::ProtobufSocketCommunicator::on_new_connection(
395+void mf::SocketCommunicator::on_new_connection(
396 std::shared_ptr<mfd::SocketSession> const& session,
397 const boost::system::error_code& ec)
398 {
399
400=== renamed file 'src/server/frontend/protobuf_socket_communicator.h' => 'src/server/frontend/socket_communicator.h'
401--- src/server/frontend/protobuf_socket_communicator.h 2013-03-21 03:32:59 +0000
402+++ src/server/frontend/socket_communicator.h 2013-04-01 21:52:22 +0000
403@@ -16,8 +16,8 @@
404 * Authored by: Thomas Guest <thomas.guest@canonical.com>
405 */
406
407-#ifndef MIR_FRONTEND_PROTOBUF_ASIO_COMMUNICATOR_H_
408-#define MIR_FRONTEND_PROTOBUF_ASIO_COMMUNICATOR_H_
409+#ifndef MIR_FRONTEND_SOCKET_COMMUNICATOR_H_
410+#define MIR_FRONTEND_SOCKET_COMMUNICATOR_H_
411
412 #include "connected_sessions.h"
413
414@@ -51,16 +51,16 @@
415 struct SocketSession;
416 }
417
418-class ProtobufSocketCommunicator : public Communicator
419+class SocketCommunicator : public Communicator
420 {
421 public:
422 // Create communicator based on Boost asio and Google protobufs
423 // using the supplied socket.
424- explicit ProtobufSocketCommunicator(
425+ explicit SocketCommunicator(
426 const std::string& socket_file,
427 std::shared_ptr<ProtobufIpcFactory> const& ipc_factory,
428 int threads);
429- ~ProtobufSocketCommunicator();
430+ ~SocketCommunicator();
431 void start();
432
433 private:
434@@ -80,4 +80,4 @@
435 }
436 }
437
438-#endif // MIR_FRONTEND_PROTOBUF_ASIO_COMMUNICATOR_H_
439+#endif // MIR_FRONTEND_SOCKET_COMMUNICATOR_H_
440
441=== modified file 'src/server/frontend/socket_session.cpp'
442--- src/server/frontend/socket_session.cpp 2013-03-22 15:11:46 +0000
443+++ src/server/frontend/socket_session.cpp 2013-04-01 21:52:22 +0000
444@@ -89,7 +89,7 @@
445
446 std::istream msg(&message);
447
448- if (processor->process_message(msg))
449+ if (!processor || processor->process_message(msg))
450 {
451 read_next_message();
452 }
453
454=== modified file 'src/server/frontend/socket_session.h'
455--- src/server/frontend/socket_session.h 2013-03-13 04:54:15 +0000
456+++ src/server/frontend/socket_session.h 2013-04-01 21:52:22 +0000
457@@ -40,8 +40,7 @@
458 std::shared_ptr<ConnectedSessions<SocketSession>> const& connected_sessions) :
459 socket(io_service),
460 id_(id_),
461- connected_sessions(connected_sessions),
462- processor(std::make_shared<NullMessageProcessor>()) {}
463+ connected_sessions(connected_sessions) {}
464
465 int id() const { return id_; }
466
467
468=== modified file 'tests/mir_test_doubles/test_protobuf_socket_server.cpp'
469--- tests/mir_test_doubles/test_protobuf_socket_server.cpp 2013-03-13 08:09:52 +0000
470+++ tests/mir_test_doubles/test_protobuf_socket_server.cpp 2013-04-01 21:52:22 +0000
471@@ -17,7 +17,7 @@
472 */
473
474 #include "mir_test/test_protobuf_server.h"
475-#include "src/server/frontend/protobuf_socket_communicator.h"
476+#include "src/server/frontend/socket_communicator.h"
477
478 namespace mt = mir::test;
479 namespace mtd = mir::test::doubles;
480@@ -34,5 +34,5 @@
481
482 std::shared_ptr<mf::Communicator> mt::TestProtobufServer::make_communicator(const std::string& socket_name, std::shared_ptr<frontend::ProtobufIpcFactory> const& factory)
483 {
484- return std::make_shared<mf::ProtobufSocketCommunicator>(socket_name, factory, 10);
485+ return std::make_shared<mf::SocketCommunicator>(socket_name, factory, 10);
486 }

Subscribers

People subscribed via source and target branches