Skip to content

Commit c03316a

Browse files
committed
Report active user even if session is not active (#210)
1 parent 373e389 commit c03316a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

core/src/main/java/xyz/gianlu/librespot/core/ZeroconfServer.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ public void closeSession() throws IOException {
221221
connectionTime = 0;
222222
}
223223

224-
private boolean hasActiveSession() {
225-
boolean valid = session != null && session.isValid() && session.isActive();
224+
private boolean hasValidSession() {
225+
boolean valid = session != null && session.isValid();
226226
if (!valid) {
227227
session = null;
228228
connectionTime = 0;
@@ -231,9 +231,13 @@ private boolean hasActiveSession() {
231231
return valid;
232232
}
233233

234+
private boolean hasActiveSession() {
235+
return hasValidSession() && session.isActive();
236+
}
237+
234238
private void handleGetInfo(OutputStream out, String httpVersion) throws IOException {
235239
JsonObject info = DEFAULT_GET_INFO_FIELDS.deepCopy();
236-
info.addProperty("activeUser", hasActiveSession() ? session.username() : "");
240+
info.addProperty("activeUser", hasValidSession() ? session.username() : "");
237241
info.addProperty("deviceID", inner.deviceId);
238242
info.addProperty("remoteName", inner.deviceName);
239243
info.addProperty("publicKey", Base64.getEncoder().encodeToString(keys.publicKeyArray()));

0 commit comments

Comments
 (0)