Permalink
Browse files

checksum is transmitted to the client.

  • Loading branch information...
1 parent e034733 commit 1744e69214c99be5f8ee5d9fa9b2964b73b6489f DennisOSRM committed Feb 17, 2012
Showing with 11 additions and 5 deletions.
  1. +8 −3 Descriptors/JSONDescriptor.h
  2. +1 −0 Plugins/RawRouteData.h
  3. +2 −2 Plugins/ViaRoutePlugin.h
View
11 Descriptors/JSONDescriptor.h
@@ -151,8 +151,8 @@ class JSONDescriptor : public BaseDescriptor<SearchEngineT>{
reply.content += "],";
//list all viapoints so that the client may display it
reply.content += "\"via_points\":[";
+ std::string tmp;
if(true == config.geometry) {
- std::string tmp;
for(unsigned segmentIdx = 1; segmentIdx < rawRoute.segmentEndCoordinates.size(); ++segmentIdx) {
if(segmentIdx > 1)
reply.content += ",";
@@ -166,8 +166,13 @@ class JSONDescriptor : public BaseDescriptor<SearchEngineT>{
reply.content += "]";
}
}
- reply.content += "],"
- "\"transactionId\": \"OSRM Routing Engine JSON Descriptor (v0.3)\"";
+ reply.content += "],";
+ reply.content += "\"route_data\": {";
+ reply.content += "\"checksum\":";
+ intToString(rawRoute.checkSum, tmp);
+ reply.content += tmp;
+ reply.content += "},";
+ reply.content += "\"transactionId\": \"OSRM Routing Engine JSON Descriptor (v0.3)\"";
reply.content += "}";
}
View
1 Plugins/RawRouteData.h
@@ -25,6 +25,7 @@ struct RawRouteData {
std::vector< _PathData > computedRouted;
std::vector< PhantomNodes > segmentEndCoordinates;
std::vector< _Coordinate > rawViaNodeCoordinates;
+ unsigned checkSum;
};
#endif /* RAWROUTEDATA_H_ */
View
4 Plugins/ViaRoutePlugin.h
@@ -94,7 +94,7 @@ class ViaRoutePlugin : public BasePlugin {
_Coordinate startCoord(lat1, lon1);
_Coordinate targetCoord(lat2, lon2);
RawRouteData rawRoute;
-
+ rawRoute.checkSum = nodeHelpDesk->GetCheckSum();
if(false == checkCoord(startCoord) || false == checkCoord(targetCoord)) {
reply = http::Reply::stockReply(http::Reply::badRequest);
return;
@@ -152,7 +152,7 @@ class ViaRoutePlugin : public BasePlugin {
std::string JSONParameter = routeParameters.options.Find("jsonp");
if("" != JSONParameter) {
reply.content += JSONParameter;
- reply.content += "(\n";
+ reply.content += "(";
}
_DescriptorConfig descriptorConfig;

0 comments on commit 1744e69

Please sign in to comment.