From ed2e863fe4acfdb5015b5514c3219bef8c215ff3 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 17 May 2018 10:54:50 +0300 Subject: xmpp: fix cleanup of idle connections --- juick-server/src/main/java/com/juick/server/XMPPServer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'juick-server/src/main/java/com') diff --git a/juick-server/src/main/java/com/juick/server/XMPPServer.java b/juick-server/src/main/java/com/juick/server/XMPPServer.java index bf8ed228..1ae2bbdf 100644 --- a/juick-server/src/main/java/com/juick/server/XMPPServer.java +++ b/juick-server/src/main/java/com/juick/server/XMPPServer.java @@ -392,14 +392,14 @@ public class XMPPServer implements ConnectionListener, AutoCloseable { @Scheduled(fixedDelay = 10000) public void cleanUp() { Instant now = Instant.now(); - outConnections.keySet().stream().filter(c -> Duration.between(now, c.getUpdated()).toMinutes() > TIMEOUT_MINUTES) + outConnections.keySet().stream().filter(c -> Duration.between(c.getUpdated(), now).toMinutes() > TIMEOUT_MINUTES) .forEach(c -> { logger.info("closing idle outgoing connection to {}", c.to); c.logoff(); outConnections.remove(c); }); - inConnections.stream().filter(c -> Duration.between(now, c.updated).toMinutes() > TIMEOUT_MINUTES) + inConnections.stream().filter(c -> Duration.between(c.updated, now).toMinutes() > TIMEOUT_MINUTES) .forEach(c -> { logger.info("closing idle incoming connection from {}", c.from); c.closeConnection(); -- cgit v1.2.3