You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an unstable connection so it can disconnect at any time, but SteamKit doesn't detect it's actually lost connection to the steam servers for ~30 seconds after my connection disconnects. This can cause my app to send a request when it's already lost connection, and if I use await instead of the callback handler this causes an infinite hang.
Can be reproduced with this (admittedly convoluted example):
static async Task Test()
{
bool isLoggedIn = false;
var steamClient = new SteamClient();
var manager = new CallbackManager(steamClient);
manager.Subscribe<SteamClient.ConnectedCallback>(callback =>
{
Console.WriteLine("Connected");
steamClient.GetHandler<SteamUser>()!.LogOnAnonymous();
});
manager.Subscribe<SteamClient.DisconnectedCallback>(callback => Console.WriteLine("Disconnected"));
manager.Subscribe<SteamUser.LoggedOnCallback>(callback =>
{
isLoggedIn = true;
Console.WriteLine("Logged on");
});
manager.Subscribe<SteamUser.LoggedOffCallback>(callback => Console.WriteLine("Logged off"));
manager.Subscribe<SteamApps.PICSProductInfoCallback>(callback => Console.WriteLine(JsonConvert.SerializeObject(callback)));
steamClient.Connect();
for (int i = 1; i < 10_000; i++)
{
manager.RunWaitCallbacks(TimeSpan.FromSeconds(1));
if (i % 19 == 0) steamClient.Disconnect();
if (i % 10 == 0 && isLoggedIn)
{
Console.WriteLine(steamClient.IsConnected);
var appRequest = new SteamApps.PICSRequest(1245620, 0);
var app = await steamClient.GetHandler<SteamApps>()!.PICSGetProductInfo(app: appRequest, package: null, metaDataOnly: false);
// ^^ On the 2nd call, when the connection is disconnected this hangs indefinitely, of course, in this example I know it's disconnected, because steamClient.IsConnected is false, but if my internet hard disconnects IsConnected is still true when the call fires
Console.WriteLine(JsonConvert.SerializeObject(app));
}
}
}
f I use a callback (SteamApps.PICSProductInfoCallback) it's OK but async/await is much more convenient. Is there any way to get it to timeout instead of just hanging indefinitely? Thanks
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I have an unstable connection so it can disconnect at any time, but SteamKit doesn't detect it's actually lost connection to the steam servers for ~30 seconds after my connection disconnects. This can cause my app to send a request when it's already lost connection, and if I use await instead of the callback handler this causes an infinite hang.
Can be reproduced with this (admittedly convoluted example):
f I use a callback (
SteamApps.PICSProductInfoCallback
) it's OK but async/await is much more convenient. Is there any way to get it to timeout instead of just hanging indefinitely? ThanksBeta Was this translation helpful? Give feedback.
All reactions