Skip to content

Commit

Permalink
Report active user even if session is not active (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
devgianlu committed Apr 22, 2020
1 parent 373e389 commit c03316a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions core/src/main/java/xyz/gianlu/librespot/core/ZeroconfServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ public void closeSession() throws IOException {
connectionTime = 0;
}

private boolean hasActiveSession() {
boolean valid = session != null && session.isValid() && session.isActive();
private boolean hasValidSession() {
boolean valid = session != null && session.isValid();
if (!valid) {
session = null;
connectionTime = 0;
Expand All @@ -231,9 +231,13 @@ private boolean hasActiveSession() {
return valid;
}

private boolean hasActiveSession() {
return hasValidSession() && session.isActive();
}

private void handleGetInfo(OutputStream out, String httpVersion) throws IOException {
JsonObject info = DEFAULT_GET_INFO_FIELDS.deepCopy();
info.addProperty("activeUser", hasActiveSession() ? session.username() : "");
info.addProperty("activeUser", hasValidSession() ? session.username() : "");
info.addProperty("deviceID", inner.deviceId);
info.addProperty("remoteName", inner.deviceName);
info.addProperty("publicKey", Base64.getEncoder().encodeToString(keys.publicKeyArray()));
Expand Down

0 comments on commit c03316a

Please sign in to comment.