mirror of
https://github.com/mtheall/ftpd.git
synced 2025-06-18 19:15:33 -04:00
Log network status changes
This commit is contained in:
parent
889283aa91
commit
de0bcec978
@ -3,7 +3,7 @@
|
|||||||
// - RFC 3659 (https://tools.ietf.org/html/rfc3659)
|
// - RFC 3659 (https://tools.ietf.org/html/rfc3659)
|
||||||
// - suggested implementation details from https://cr.yp.to/ftp/filesystem.html
|
// - suggested implementation details from https://cr.yp.to/ftp/filesystem.html
|
||||||
//
|
//
|
||||||
// Copyright (C) 2023 Michael Theall
|
// Copyright (C) 2024 Michael Theall
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
@ -173,8 +173,23 @@ bool getNetworkVisibility ()
|
|||||||
auto const lock = std::scoped_lock (s_acuFence);
|
auto const lock = std::scoped_lock (s_acuFence);
|
||||||
|
|
||||||
// get wifi status
|
// get wifi status
|
||||||
|
static std::uint32_t lastWifi = 0;
|
||||||
|
static Result lastResult = 0;
|
||||||
|
|
||||||
std::uint32_t wifi = 0;
|
std::uint32_t wifi = 0;
|
||||||
if (R_FAILED (ACU_GetWifiStatus (&wifi)) || !wifi)
|
auto const result = ACU_GetWifiStatus (&wifi);
|
||||||
|
if (result != lastResult)
|
||||||
|
info ("ACU_GetWifiStatus: result 0x%lx -> 0x%lx\n", lastResult, result);
|
||||||
|
lastResult = result;
|
||||||
|
|
||||||
|
if (R_SUCCEEDED (result))
|
||||||
|
{
|
||||||
|
if (wifi != lastWifi)
|
||||||
|
info ("ACU_GetWifiStatus: wifi 0x%lx -> 0x%lx\n", lastWifi, wifi);
|
||||||
|
lastWifi = wifi;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (R_FAILED (result) || !wifi)
|
||||||
{
|
{
|
||||||
#ifdef CLASSIC
|
#ifdef CLASSIC
|
||||||
s_addr = 0;
|
s_addr = 0;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// - RFC 3659 (https://tools.ietf.org/html/rfc3659)
|
// - RFC 3659 (https://tools.ietf.org/html/rfc3659)
|
||||||
// - suggested implementation details from https://cr.yp.to/ftp/filesystem.html
|
// - suggested implementation details from https://cr.yp.to/ftp/filesystem.html
|
||||||
//
|
//
|
||||||
// Copyright (C) 2023 Michael Theall
|
// Copyright (C) 2024 Michael Theall
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
@ -733,10 +733,37 @@ bool platform::networkVisible ()
|
|||||||
if (s_activeAP)
|
if (s_activeAP)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
static NifmInternetConnectionType lastType;
|
||||||
|
static std::uint32_t lastWifi;
|
||||||
|
static NifmInternetConnectionStatus lastStatus;
|
||||||
|
static Result lastResult;
|
||||||
|
|
||||||
NifmInternetConnectionType type;
|
NifmInternetConnectionType type;
|
||||||
std::uint32_t wifi;
|
std::uint32_t wifi;
|
||||||
NifmInternetConnectionStatus status;
|
NifmInternetConnectionStatus status;
|
||||||
if (R_FAILED (nifmGetInternetConnectionStatus (&type, &wifi, &status)))
|
|
||||||
|
auto const result = nifmGetInternetConnectionStatus (&type, &wifi, &status);
|
||||||
|
if (result != lastResult)
|
||||||
|
info ("nifmGetInternetConnectionStatus: result 0x%x -> 0x%x\n", lastResult, result);
|
||||||
|
lastResult = result;
|
||||||
|
|
||||||
|
if (R_SUCCEEDED (result))
|
||||||
|
{
|
||||||
|
if (type != lastType)
|
||||||
|
info ("nifmGetInternetConnectionStatus: type 0x%x -> 0x%x\n", lastType, type);
|
||||||
|
|
||||||
|
if (wifi != lastWifi)
|
||||||
|
info ("nifmGetInternetConnectionStatus: wifi 0x%x -> 0x%x\n", lastWifi, wifi);
|
||||||
|
|
||||||
|
if (status != lastStatus)
|
||||||
|
info ("nifmGetInternetConnectionStatus: status 0x%x -> 0x%x\n", lastStatus, status);
|
||||||
|
|
||||||
|
lastType = type;
|
||||||
|
lastWifi = wifi;
|
||||||
|
lastStatus = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (R_FAILED (result))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return status == NifmInternetConnectionStatus_Connected;
|
return status == NifmInternetConnectionStatus_Connected;
|
||||||
|
Loading…
Reference in New Issue
Block a user