steamutils 1.4.66 → 1.4.67
Sign up to get free protection for your applications and to get access to all the features.
- package/SteamClient.js +33 -31
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -2131,49 +2131,51 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
2131
2131
|
clearTimeout(_cleanNodeSteamFriendTimeout);
|
2132
2132
|
}
|
2133
2133
|
|
2134
|
-
steamClient
|
2135
|
-
|
2134
|
+
if (steamClient) {
|
2135
|
+
steamClient.logOff();
|
2136
|
+
await sleep(5000);
|
2136
2137
|
|
2137
|
-
|
2138
|
+
steamClient._connection?.end(true);
|
2138
2139
|
|
2139
|
-
|
2140
|
-
|
2140
|
+
function cleanSteamClient(obj, key) {
|
2141
|
+
const value = obj[key];
|
2141
2142
|
|
2142
|
-
|
2143
|
-
|
2144
|
-
|
2145
|
-
|
2146
|
-
|
2143
|
+
try {
|
2144
|
+
delete obj[key];
|
2145
|
+
} catch (e) {
|
2146
|
+
return;
|
2147
|
+
}
|
2147
2148
|
|
2148
|
-
|
2149
|
-
|
2150
|
-
|
2149
|
+
if (!value) {
|
2150
|
+
return;
|
2151
|
+
}
|
2151
2152
|
|
2152
|
-
|
2153
|
-
|
2154
|
-
|
2153
|
+
if (typeof value !== "object") {
|
2154
|
+
return;
|
2155
|
+
}
|
2155
2156
|
|
2156
|
-
|
2157
|
-
|
2158
|
-
} else {
|
2159
|
-
const constructorName = Object.getPrototypeOf(value)?.constructor?.name;
|
2160
|
-
if (constructorName === "TLSSocket") {
|
2161
|
-
value.destroy?.();
|
2162
|
-
} else if (constructorName === "Timeout") {
|
2163
|
-
clearTimeout(value);
|
2164
|
-
} else if (constructorName === "SteamUser") {
|
2157
|
+
if (Array.isArray(value)) {
|
2158
|
+
value.length = 0;
|
2165
2159
|
} else {
|
2166
|
-
|
2167
|
-
|
2160
|
+
const constructorName = Object.getPrototypeOf(value)?.constructor?.name;
|
2161
|
+
if (constructorName === "TLSSocket") {
|
2162
|
+
value.destroy?.();
|
2163
|
+
} else if (constructorName === "Timeout") {
|
2164
|
+
clearTimeout(value);
|
2165
|
+
} else if (constructorName === "SteamUser") {
|
2166
|
+
} else {
|
2167
|
+
for (const valuekey in value) {
|
2168
|
+
cleanSteamClient(value, valuekey);
|
2169
|
+
}
|
2168
2170
|
}
|
2169
2171
|
}
|
2170
2172
|
}
|
2171
|
-
}
|
2172
2173
|
|
2173
|
-
|
2174
|
-
|
2174
|
+
for (const key in steamClient) {
|
2175
|
+
cleanSteamClient(steamClient, key);
|
2176
|
+
}
|
2177
|
+
steamClient = null;
|
2175
2178
|
}
|
2176
|
-
steamClient = null;
|
2177
2179
|
}
|
2178
2180
|
|
2179
2181
|
async function init() {
|