~stolowski/unity-scopes-api/fix-1393382-rtm

« back to all changes in this revision

Viewing changes to src/scopes/internal/zmq_middleware/ZmqRegistry.cpp

  • Committer: Pawel Stolowski
  • Date: 2014-11-04 14:33:07 UTC
  • mfrom: (241.1.20 unity-scopes-api)
  • Revision ID: pawel.stolowski@canonical.com-20141104143307-cs70gjyowjtwpk69
Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <unity/scopes/internal/ScopeMetadataImpl.h>
25
25
#include <unity/scopes/internal/zmq_middleware/VariantConverter.h>
26
26
#include <unity/scopes/internal/zmq_middleware/ZmqException.h>
 
27
#include <unity/scopes/internal/zmq_middleware/ZmqReceiver.h>
27
28
#include <unity/scopes/internal/zmq_middleware/ZmqScope.h>
28
29
#include <unity/scopes/ScopeExceptions.h>
29
30
 
88
89
    // Registry operations can be slow during start-up of the phone
89
90
    int64_t timeout = mw_base()->registry_timeout();
90
91
    auto future = mw_base()->twoway_pool()->submit([&] { return this->invoke_twoway_(request_builder, timeout); });
91
 
    auto receiver = future.get();
92
 
    auto segments = receiver.receive();
93
 
    capnp::SegmentArrayMessageReader reader(segments);
94
 
    auto response = reader.getRoot<capnproto::Response>();
 
92
    auto out_params = future.get();
 
93
    auto response = out_params.reader->getRoot<capnproto::Response>();
95
94
    throw_if_runtime_exception(response);
96
95
 
97
96
    auto get_metadata_response = response.getPayload().getAs<capnproto::Registry::GetMetadataResponse>().getResponse();
124
123
    // Registry operations can be slow during start-up of the phone
125
124
    int64_t timeout = mw_base()->registry_timeout();
126
125
    auto future = mw_base()->twoway_pool()->submit([&] { return this->invoke_twoway_(request_builder, timeout); });
127
 
    auto receiver = future.get();
128
 
    auto segments = receiver.receive();
129
 
    capnp::SegmentArrayMessageReader reader(segments);
130
 
    auto response = reader.getRoot<capnproto::Response>();
 
126
    auto out_params = future.get();
 
127
    auto response = out_params.reader->getRoot<capnproto::Response>();
131
128
    throw_if_runtime_exception(response);
132
129
 
133
130
    auto list_response = response.getPayload().getAs<capnproto::Registry::ListResponse>();
153
150
 
154
151
    // locate uses a custom timeout because it needs to potentially fork/exec a scope.
155
152
    auto future = mw_base()->twoway_pool()->submit([&] { return this->invoke_twoway_(request_builder, timeout); });
156
 
    auto receiver = future.get();
157
 
    auto segments = receiver.receive();
158
 
    capnp::SegmentArrayMessageReader reader(segments);
159
 
    auto response = reader.getRoot<capnproto::Response>();
 
153
    auto out_params = future.get();
 
154
    auto response = out_params.reader->getRoot<capnproto::Response>();
160
155
    throw_if_runtime_exception(response);
161
156
 
162
157
    auto locate_response = response.getPayload().getAs<capnproto::Registry::LocateResponse>().getResponse();
206
201
    // Registry operations can be slow during start-up of the phone
207
202
    int64_t timeout = mw_base()->registry_timeout();
208
203
    auto future = mw_base()->twoway_pool()->submit([&] { return this->invoke_twoway_(request_builder, timeout); });
209
 
    auto receiver = future.get();
210
 
    auto segments = receiver.receive();
211
 
    capnp::SegmentArrayMessageReader reader(segments);
212
 
    auto response = reader.getRoot<capnproto::Response>();
 
204
    auto out_params = future.get();
 
205
    auto response = out_params.reader->getRoot<capnproto::Response>();
213
206
    throw_if_runtime_exception(response);
214
207
 
215
208
    auto is_scope_running_response = response.getPayload().getAs<capnproto::Registry::IsScopeRunningResponse>().getResponse();