stephb9959
2023-05-02 09:05:44 -07:00
parent 7b17af5575
commit fdb09654c2
5 changed files with 8 additions and 3 deletions

2
build
View File

@@ -1 +1 @@
44
45

View File

@@ -75,6 +75,7 @@ if [[ "$TEMPLATE_CONFIG" = 'true' ]]; then
STORAGE_TYPE_MYSQL_PORT=${STORAGE_TYPE_MYSQL_PORT:-"3306"} \
CERTIFICATES_ALLOWMISMATCH=${CERTIFICATES_ALLOWMISMATCH:-"false"} \
IPINFO_DEFAULT_COUNTRY=${IPINFO_DEFAULT_COUNTRY:-"US"} \
DEVICE_SESSION_TIMEOUT=${DEVICE_SESSION_TIMEOUT:-"600"} \
envsubst < /owgw.properties.tmpl > $OWGW_CONFIG/owgw.properties
fi

View File

@@ -85,6 +85,7 @@ iptocountry.ipdata.apikey = ${IPTOCOUNTRY_IPDATA_APIKEY}
autoprovisioning.process = ${AUTOPROVISIONING_PROCESS}
openwifi.session.timeout = ${DEVICE_SESSION_TIMEOUT}
#
# rtty
#

View File

@@ -55,6 +55,8 @@ namespace OpenWifi {
MicroServiceConfigGetBool("openwifi.certificates.allowmismatch", true);
MismatchDepth_ = MicroServiceConfigGetInt("openwifi.certificates.mismatchdepth", 2);
SessionTimeOut_ = MicroServiceConfigGetInt("openwifi.session.timeout", 10*60);
Reactor_pool_ = std::make_unique<AP_WS_ReactorThreadPool>();
Reactor_pool_->Start();
@@ -188,8 +190,9 @@ namespace OpenWifi {
while (hint != end(SerialNumbers_)) {
if (hint->second.second == nullptr) {
hint = SerialNumbers_.erase(hint);
} else if ((now - hint->second.second->State_.LastContact) > (10 * 60)) {
} else if ((now - hint->second.second->State_.LastContact) > SessionTimeOut_) {
hint->second.second->EndConnection(false);
poco_information(Logger(),fmt::format("{}: Session seems idle. Controller disconnecting device.", hint->second.second->SerialNumber_));
Sessions_.erase(hint->second.second->State_.sessionId);
Garbage_.push_back(hint->second.second);
hint = SerialNumbers_.erase(hint);

View File

@@ -254,7 +254,7 @@ namespace OpenWifi {
std::uint64_t NumberOfConnectedDevices_ = 0;
std::uint64_t AverageDeviceConnectionTime_ = 0;
std::uint64_t NumberOfConnectingDevices_ = 0;
std::uint64_t SessionTimeOut_ = 10*60;
mutable std::mutex StatsMutex_;
std::atomic_uint64_t TX_=0,RX_=0;