test(hg-friends): enforce bounded relog retry, no false offline, requested-only foreign status
This commit is contained in:
1 parent
099a474cac
commit
7e287f29f9
1 file changed
+43
-1
@@ -42,4 +42,46 @@ assert body.count("userdata.ServerURLs = null;") >= 6
|
||||
assert body.count('serverType.Equals("FriendsServerURI", StringComparison.OrdinalIgnoreCase)') >= 4
|
||||
assert body.count("userdata.LastWebFail = Util.GetTimeStamp();") >= 6
|
||||
assert "BADURLEXPIRE * 1000" in body
|
||||
print("OGL HG friends: all-presence delivery, duplicate guard, recoverable URL cache: OK")
|
||||
# A foreign home-grid may not be reachable on the *first* status
|
||||
# lookup at viewer login. Confirm that delayed reconciliation is bounded,
|
||||
# does not invent online status, does not refresh local users, and never
|
||||
# publishes a foreign UUID not present in the requested friend list.
|
||||
module = read("OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs")
|
||||
for marker in (
|
||||
"using System.Threading.Tasks;",
|
||||
"PresenceRetrySeconds",
|
||||
"PresenceRetryAttempts",
|
||||
"PendingForeignPresence(client.AgentId).Count > 0",
|
||||
"_ = RetryForeignPresenceAsync(client);",
|
||||
"private List<string> PendingForeignPresence(UUID owner)",
|
||||
"(friend.TheirFlags & (int)FriendRights.CanSeeOnline) == 0",
|
||||
"IsFriendOnline(owner, friendId)",
|
||||
"private async Task RetryForeignPresenceAsync(IClientAPI client)",
|
||||
"await Task.Delay(TimeSpan.FromSeconds(retrySeconds))",
|
||||
"LocateClientObject(owner) != client",
|
||||
"GetOnlineFriends(owner, pending, online)",
|
||||
"client.SendAgentOnline(online.ToArray())",
|
||||
"HashSet<UUID> requested = new();",
|
||||
"if (!requested.Contains(friendID))",
|
||||
):
|
||||
assert marker in module, "HG foreign reconnect reconciliation missing: " + marker
|
||||
assert "m_HGPresenceRetryAttempts = Math.Clamp(" in module
|
||||
assert "0, 4);" in module, "foreign status requests need a hard retry bound"
|
||||
retry = module.split("private async Task RetryForeignPresenceAsync", 1)[1].split(
|
||||
"protected override void GetOnlineFriends", 1)[0]
|
||||
assert retry.index("LocateClientObject(owner) != client") < retry.index("GetOnlineFriends(owner, pending, online)")
|
||||
assert retry.index("GetOnlineFriends(owner, pending, online)") < retry.index("client.SendAgentOnline(online.ToArray())")
|
||||
assert "SendAgentOffline" not in retry, "an unreachable HG grid must not be treated as proven offline"
|
||||
getonline = module.split("protected override void GetOnlineFriends", 1)[1].split(
|
||||
"protected override void StatusNotify", 1)[0]
|
||||
assert getonline.index("HashSet<UUID> requested") < getonline.index("connector.StatusNotification(")
|
||||
assert getonline.index("if (!requested.Contains(friendID))") < getonline.index("friends.Add(friendID);")
|
||||
|
||||
for path in ("bin/config-include/GridCommon.ini",
|
||||
"bin/config-include/GridCommon.ini.example",
|
||||
"bin/config-include/StandaloneCommon.ini.example"):
|
||||
cfg = read(path).split("[HGFriendsModule]", 1)[1].split("\n[", 1)[0]
|
||||
assert "PresenceRetrySeconds = 135" in cfg, path
|
||||
assert "PresenceRetryAttempts = 3" in cfg, path
|
||||
|
||||
print("OGL HG friends: all-presence delivery, duplicate guard, recoverable URL cache, bounded relog presence retries: OK")
|
||||
Reference in new issue
Block a user