Parcourir la source

resource: assume client is up to date if never seen before

Fixes: #116
Daniele Bartolini il y a 2 ans
Parent
commit
6cb48d8e80
2 fichiers modifiés avec 6 ajouts et 7 suppressions
  1. 2 7
      src/device/device.cpp
  2. 4 0
      src/resource/data_compiler.cpp

+ 2 - 7
src/device/device.cpp

@@ -731,9 +731,9 @@ void Device::destroy_resource_package(ResourcePackage &rp)
 	CE_DELETE(default_allocator(), &rp);
 }
 
-#if CROWN_DEBUG
 void Device::refresh()
 {
+#if CROWN_DEBUG
 	TempAllocator4096 ta;
 	Array<char> msg(ta);
 	StringStream ss(ta);
@@ -814,13 +814,8 @@ void Device::refresh()
 		if (_paused)
 			unpause();
 	}
-}
-#else
-void Device::refresh()
-{
-	// Do nothing
-}
 #endif // if CROWN_DEBUG
+}
 
 char _buffer[sizeof(Device)];
 Device *_device = NULL;

+ 4 - 0
src/resource/data_compiler.cpp

@@ -234,6 +234,10 @@ static void console_command_refresh_list(ConsoleServer &cs, u32 client_id, const
 	sjson::parse(obj, json);
 	Guid client_guid = sjson::parse_guid(obj["client_id"]);
 
+	// Assume client is up to date, if never seen before.
+	if (!hash_map::has(dc->_client_revisions, client_guid))
+		hash_map::set(dc->_client_revisions, client_guid, dc->_revision);
+
 	ss << "{\"type\":\"refresh_list\",\"list\":[";
 	auto cur = hash_map::begin(dc->_data_revisions);
 	auto end = hash_map::end(dc->_data_revisions);