Browse Source

Send timestamp with new circuit test response.

Adam Ierymenko 8 years ago
parent
commit
a109d341ef

+ 3 - 3
controller/EmbeddedNetworkController.cpp

@@ -782,8 +782,8 @@ unsigned int EmbeddedNetworkController::handleControlPlaneHttpPOST(
 						return 500;
 					}
 
-					char json[1024];
-					Utils::snprintf(json,sizeof(json),"{\"testId\":\"%.16llx\"}",test->testId);
+					char json[512];
+					Utils::snprintf(json,sizeof(json),"{\"testId\":\"%.16llx\",\"timestamp\":%llu}",test->testId,test->timestamp);
 					responseBody = json;
 					responseContentType = "application/json";
 
@@ -1808,7 +1808,7 @@ void EmbeddedNetworkController::_pushMemberUpdate(uint64_t now,uint64_t nwid,con
 			bool online;
 			{
 				Mutex::Lock _l(_lastRequestTime_m);
-				std::map<std::pair<uint64_t,uint64_t>,uint64_t>::iterator lrt(_lastRequestTime.find(std::pair<uint64_t,uint64_t>(id.address().toInt(),nwid)));
+				std::map< std::pair<uint64_t,uint64_t>,uint64_t >::iterator lrt(_lastRequestTime.find(std::pair<uint64_t,uint64_t>(id.address().toInt(),nwid)));
 				online = ( (lrt != _lastRequestTime.end()) && ((now - lrt->second) < ZT_NETWORK_AUTOCONF_DELAY) );
 			}
 			if (online) {

+ 1 - 1
controller/EmbeddedNetworkController.hpp

@@ -204,7 +204,7 @@ private:
 	std::list< ZT_CircuitTest > _tests;
 	Mutex _tests_m;
 
-	std::map< std::pair<uint64_t,uint64_t>,uint64_t > _lastRequestTime;
+	std::map< std::pair<uint64_t,uint64_t>,uint64_t > _lastRequestTime; // last request time by <address,networkId>
 	Mutex _lastRequestTime_m;
 };