
#include <boost/assert.hpp>

#include "worker.h"
#include "requests.pb.h"


bool traffic::MessageWorker::process(std::string &result, void *data, size_t size)
{
	(void) result;

	request::Request request;
	request.ParseFromArray(data, size);

	switch (request.Payload_case()) {
		case request::Request::kStatistic:
			return process_statistics();
		case request::Request::kSummary:
			return process_summary();
		case request::Request::PAYLOAD_NOT_SET:
			return false;
	}

	BOOST_ASSERT(false && "Message parsing failed!");

	return false;
}


#include <boost/assert.hpp>

#include "worker.h"
#include "requests.pb.h"


bool traffic::MessageWorker::process(std::string &result, void *data, size_t size)
{
	(void) result;

	request::Request request;
	request.ParseFromArray(data, size);

	if (request.has_statistic())
		return process_statistics();
	else if (request.has_summary())
		return process_summary();

	BOOST_ASSERT(false && "Unknown message type");

	return false;
}

--- 
+++ 
@@ -12,12 +12,16 @@
 	request::Request request;
 	request.ParseFromArray(data, size);
 
-	if (request.has_statistic())
-		return process_statistics();
-	else if (request.has_summary())
-		return process_summary();
+	switch (request.Payload_case()) {
+		case request::Request::kStatistic:
+			return process_statistics();
+		case request::Request::kSummary:
+			return process_summary();
+		case request::Request::PAYLOAD_NOT_SET:
+			return false;
+	}
 
-	BOOST_ASSERT(false && "Unknown message type");
+	BOOST_ASSERT(false && "Message parsing failed!");
 
 	return false;
 }
Use the generated oneo proto enum

Signed-off-by: Jan Losinski <577c4104c61edf9f052c616c0c23e67bef4a9955@wh2.tu-dresden.de>
