Collegamento e motore: correzioni regole-1, regole-2, regole-6, websec-1, websec-5, websec-6, engine-1, engine-2, sched-1
Pagine aperte da Alberto non sono segnali (regole-1); cookie perso fuori sessione = disconnessione (regole-2); pagina a riposo quando Alberto lascia il browser (regole-6); la lease di «Accedi»/«Usa il browser» finisce da sola dopo 2 minuti senza vista remota né finestra (websec-1); ping con scadenza sulla vista remota (websec-5); aperture della vista remota serializzate (websec-6); orologio virtuale senza fine anticipata (engine-1); la sincronizzazione della coda non duplica il compito in corso (engine-2); raccolte in evidenza programmate (sched-1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
19 files changed
+1122
-92
No files matched your search
@@ -129,6 +129,39 @@ public sealed class RemoteViewSocketTests
|
||||
Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TheServerPingsThePageAndGivesUpOnOneThatStopsAnswering()
|
||||
{
|
||||
// With an interval alone ASP.NET Core sends unsolicited pongs and never notices a page that vanished.
|
||||
var accept = RemoteViewSocket.AcceptContext();
|
||||
Assert.AreEqual(RemoteViewSocket.KeepAliveInterval, accept.KeepAliveInterval);
|
||||
Assert.IsNotNull(accept.KeepAliveTimeout, "a ping must have a deadline");
|
||||
Assert.IsTrue(accept.KeepAliveTimeout > TimeSpan.Zero && accept.KeepAliveTimeout <= TimeSpan.FromMinutes(1), $"{accept.KeepAliveTimeout}");
|
||||
Assert.IsFalse(accept.DangerousEnableCompression);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Timeout(30_000, CooperativeCancellation = true)]
|
||||
public async Task AViewWhosePageVanishedEndsWhenItsPingGoesUnanswered()
|
||||
{
|
||||
// The same keep-alive as the server, with short times: the page's machine went to sleep (it never answers).
|
||||
using var listener = new System.Net.Sockets.TcpListener(IPAddress.Loopback, 0);
|
||||
listener.Start();
|
||||
using var page = new System.Net.Sockets.TcpClient();
|
||||
await page.ConnectAsync(IPAddress.Loopback, ((IPEndPoint)listener.LocalEndpoint).Port, TestContext.CancellationToken);
|
||||
using var accepted = await listener.AcceptTcpClientAsync(TestContext.CancellationToken);
|
||||
using var socket = WebSocket.CreateFromStream(accepted.GetStream(), new WebSocketCreationOptions
|
||||
{
|
||||
IsServer = true,
|
||||
KeepAliveInterval = TimeSpan.FromMilliseconds(200),
|
||||
KeepAliveTimeout = TimeSpan.FromMilliseconds(300),
|
||||
});
|
||||
var view = new FakeRemoteViewConnection();
|
||||
var run = RemoteViewSocket.RunAsync(socket, view, CancellationToken.None);
|
||||
Assert.AreSame(run, await Task.WhenAny(run, Task.Delay(TimeSpan.FromSeconds(10), TestContext.CancellationToken)), "the view ends by itself");
|
||||
await run;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void KeysGetTheVirtualCodesChromiumNeeds()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user