Skip to content

Commit

Permalink
Fix null info in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
schnapster committed Sep 21, 2017
1 parent 4087dd7 commit ae3c79c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/logs/
/target/
/application.yml
*/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ public void onClose(int code, String reason, boolean remote) {
available = false;
reason = reason == null ? "<no reason given>" : reason;
if (code == 1000) {
log.info("Connection to " + getRemoteSocketAddress() + " closed gracefully with reason: " + reason + " :: Remote=" + remote);
log.info("Connection to " + getRemoteUri() + " closed gracefully with reason: " + reason + " :: Remote=" + remote);
} else {
log.warn("Connection to " + getRemoteSocketAddress() + " closed unexpectedly with reason " + code + ": " + reason + " :: Remote=" + remote);
log.warn("Connection to " + getRemoteUri() + " closed unexpectedly with reason " + code + ": " + reason + " :: Remote=" + remote);
}

lavalink.loadBalancer.onNodeDisconnect(this);
Expand All @@ -212,7 +212,7 @@ public void onClose(int code, String reason, boolean remote) {
@Override
public void onError(Exception ex) {
if (ex instanceof ConnectException) {
log.warn("Failed to connect to " + getRemoteSocketAddress() + ", retrying in " + getReconnectInterval()/1000 + " seconds.");
log.warn("Failed to connect to " + getRemoteUri() + ", retrying in " + getReconnectInterval()/1000 + " seconds.");
return;
}

Expand All @@ -225,7 +225,7 @@ public void send(String text) throws NotYetConnectedException {
if (isOpen()) {
super.send(text);
} else if (isConnecting()) {
log.warn("Attempting to send messages to " + getRemoteSocketAddress() + " WHILE connecting. Ignoring.");
log.warn("Attempting to send messages to " + getRemoteUri() + " WHILE connecting. Ignoring.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ public void send(String text) {
}
}

public URI getServerUri() {
return this.serverUri;
}

//will return null if there is no connection
public InetSocketAddress getRemoteSocketAddress() {
return socket.getRemoteSocketAddress();
}
Expand Down

0 comments on commit ae3c79c

Please sign in to comment.