Skip to content

Commit

Permalink
Clean up logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
greyson-signal committed Apr 27, 2020
1 parent 9c0337c commit 668ccfc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ private KbsPinData restorePin(HashedPin hashedPin, TokenResponse token)
Log.i(TAG, "Restore " + status.getStatus());
switch (status.getStatus()) {
case OK:
Log.i(TAG, String.format(Locale.US,"Restore OK! data: %s tries: %d", Hex.toStringCondensed(status.getData().toByteArray()), status.getTries()));
KbsData kbsData = hashedPin.decryptKbsDataIVCipherText(status.getData().toByteArray());
MasterKey masterKey = kbsData.getMasterKey();
return new KbsPinData(masterKey, nextToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public WebSocketConnection(String httpUri,
}

public synchronized void connect() {
Log.w(TAG, "WSC connect()...");
Log.i(TAG, "WSC connect()...");

if (client == null) {
String filledUri;
Expand Down Expand Up @@ -137,7 +137,7 @@ public synchronized void connect() {
}

public synchronized void disconnect() {
Log.w(TAG, "WSC disconnect()...");
Log.i(TAG, "WSC disconnect()...");

if (client != null) {
client.close(1000, "OK");
Expand Down Expand Up @@ -222,7 +222,7 @@ private synchronized void sendKeepAlive() throws IOException {
@Override
public synchronized void onOpen(WebSocket webSocket, Response response) {
if (client != null && keepAliveSender == null) {
Log.w(TAG, "onConnected()");
Log.i(TAG, "onConnected()");
attempts = 0;
connected = true;
keepAliveSender = new KeepAliveSender();
Expand All @@ -234,11 +234,11 @@ public synchronized void onOpen(WebSocket webSocket, Response response) {

@Override
public synchronized void onMessage(WebSocket webSocket, ByteString payload) {
Log.w(TAG, "WSC onMessage()");
Log.d(TAG, "WSC onMessage()");
try {
WebSocketMessage message = WebSocketMessage.parseFrom(payload.toByteArray());

Log.w(TAG, "Message Type: " + message.getType().getNumber());
Log.d(TAG, "Message Type: " + message.getType().getNumber());

if (message.getType().getNumber() == WebSocketMessage.Type.REQUEST_VALUE) {
incomingRequests.add(message.getRequest());
Expand All @@ -256,7 +256,7 @@ public synchronized void onMessage(WebSocket webSocket, ByteString payload) {

@Override
public synchronized void onClosed(WebSocket webSocket, int code, String reason) {
Log.w(TAG, "onClose()...");
Log.i(TAG, "onClose()...");
this.connected = false;

Iterator<Map.Entry<Long, SettableFuture<Pair<Integer, String>>>> iterator = outgoingRequests.entrySet().iterator();
Expand Down Expand Up @@ -290,8 +290,7 @@ public synchronized void onClosed(WebSocket webSocket, int code, String reason)

@Override
public synchronized void onFailure(WebSocket webSocket, Throwable t, Response response) {
Log.w(TAG, "onFailure()");
Log.w(TAG, t);
Log.w(TAG, "onFailure()", t);

if (response != null && (response.code() == 401 || response.code() == 403)) {
if (listener != null) listener.onAuthenticationFailure();
Expand All @@ -304,12 +303,12 @@ public synchronized void onFailure(WebSocket webSocket, Throwable t, Response re

@Override
public void onMessage(WebSocket webSocket, String text) {
Log.w(TAG, "onMessage(text)! " + text);
Log.d(TAG, "onMessage(text)! " + text);
}

@Override
public synchronized void onClosing(WebSocket webSocket, int code, String reason) {
Log.w(TAG, "onClosing()!...");
Log.i(TAG, "onClosing()!...");
webSocket.close(1000, "OK");
}

Expand Down Expand Up @@ -338,7 +337,7 @@ public void run() {
try {
sleepTimer.sleep(TimeUnit.SECONDS.toMillis(KEEPALIVE_TIMEOUT_SECONDS));

Log.w(TAG, "Sending keep alive...");
Log.d(TAG, "Sending keep alive...");
sendKeepAlive();
} catch (Throwable e) {
Log.w(TAG, e);
Expand Down

0 comments on commit 668ccfc

Please sign in to comment.