Skip to content

Commit 3cb1b7f

Browse files
committed
Changed logging
1 parent 792fb1f commit 3cb1b7f

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ private void handleGetInfo(OutputStream out, String httpVersion) throws IOExcept
213213
private void handleAddUser(OutputStream out, Map<String, String> params, String httpVersion) throws GeneralSecurityException, IOException {
214214
String username = params.get("userName");
215215
if (username == null) {
216-
LOGGER.fatal("Missing authUsername!");
216+
LOGGER.fatal("Missing userName!");
217217
return;
218218
}
219219

@@ -266,8 +266,14 @@ private void handleAddUser(OutputStream out, Map<String, String> params, String
266266

267267
try {
268268
Authentication.LoginCredentials credentials = inner.decryptBlob(username, decrypted);
269-
if (hasValidSession()) session.close();
269+
if (hasValidSession()) {
270+
session.close();
271+
LOGGER.trace(String.format("Closed previous session to accept new. {deviceId: %s}", session.deviceId()));
272+
}
273+
270274
session = Session.from(inner);
275+
LOGGER.info(String.format("Accepted new user. {deviceId: %s}", session.deviceId()));
276+
271277
session.connect();
272278
session.authenticate(credentials);
273279
} catch (Session.SpotifyAuthenticationException | SpotifyIrc.IrcException | MercuryClient.PubSubException ex) {

core/src/main/java/xyz/gianlu/librespot/crypto/DiffieHellman.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package xyz.gianlu.librespot.crypto;
22

3-
import org.apache.log4j.Logger;
43
import org.jetbrains.annotations.NotNull;
54
import xyz.gianlu.librespot.common.Utils;
65

@@ -25,7 +24,6 @@ public class DiffieHellman {
2524
(byte) 0x4c, (byte) 0x42, (byte) 0xe9, (byte) 0xa6, (byte) 0x3a, (byte) 0x36, (byte) 0x20, (byte) 0xff, (byte) 0xff, (byte)
2625
(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff};
2726
private static final BigInteger PRIME = new BigInteger(1, PRIME_BYTES);
28-
private static final Logger LOGGER = Logger.getLogger(DiffieHellman.class);
2927
private final BigInteger privateKey;
3028
private final BigInteger publicKey;
3129

@@ -40,10 +38,7 @@ public DiffieHellman(Random random) {
4038
@NotNull
4139
public BigInteger computeSharedKey(byte[] remoteKeyBytes) {
4240
BigInteger remoteKey = new BigInteger(1, remoteKeyBytes);
43-
BigInteger sharedKey = remoteKey.modPow(privateKey, PRIME);
44-
45-
LOGGER.trace("Computed shared key successfully!");
46-
return sharedKey;
41+
return remoteKey.modPow(privateKey, PRIME);
4742
}
4843

4944
@NotNull

0 commit comments

Comments
 (0)