Log keepalives for unsubscribed channels.

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2015-03-24 14:13:32 -07:00
parent 843b16c1f0
commit 1fcd1e33c5
1 changed files with 5 additions and 0 deletions

View File

@ -1,6 +1,8 @@
package org.whispersystems.textsecuregcm.controllers;
import com.codahale.metrics.annotation.Timed;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.textsecuregcm.storage.Account;
import org.whispersystems.textsecuregcm.storage.PubSubManager;
import org.whispersystems.textsecuregcm.websocket.WebsocketAddress;
@ -17,6 +19,8 @@ import io.dropwizard.auth.Auth;
@Path("/v1/keepalive")
public class KeepAliveController {
private final Logger logger = LoggerFactory.getLogger(KeepAliveController.class);
private final PubSubManager pubSubManager;
public KeepAliveController(PubSubManager pubSubManager) {
@ -33,6 +37,7 @@ public class KeepAliveController {
account.getAuthenticatedDevice().get().getId());
if (!pubSubManager.hasLocalSubscription(address)) {
logger.warn("***** No local subscription found for: " + address);
context.getClient().close(1000, "OK");
}
}