223 {
225
226
229 throw exc::CommunicationException("Read chunk has invalid size");
230 }
231
232 if (strncmp(chunk, "?##", 3) != 0){
233 throw exc::CommunicationException("Malformed chunk");
234 }
235
238 nread -= 3 + 6;
239 deserialize_message_header(chunk + 3, tag, len);
240
241 std::string data_acc(chunk + 3 + 6, nread);
242 data_acc.reserve(len);
243
244 while(nread < len){
246 if (chunk[0] != '?'){
247 throw exc::CommunicationException("Chunk malformed");
248 }
249
250 data_acc.append(chunk + 1, cur - 1);
251 nread += cur - 1;
252 }
253
254 if (msg_type){
255 *msg_type = static_cast<messages::MessageType>(tag);
256 }
257
258 if (nread < len){
259 throw exc::CommunicationException("Response incomplete");
260 }
261
263 if (!msg_wrap->ParseFromArray(data_acc.c_str(), len)){
264 throw exc::CommunicationException("Message could not be parsed");
265 }
266
267 msg = msg_wrap;
268 }
::google::protobuf::Message * get_message(int wire_number)
std::shared_ptr< Transport > transport(const std::string &path)