From 6e49d6cb0524cdcf25acb6938c8396f7cf485b28 Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Fri, 9 Jun 2006 23:24:54 +0000 Subject: [PATCH] Temp fix for SSL exception problem until we finish final solution that consists of changing the keep alive thread to send a hearbeat when the connection is idle (i.e. nothing has been sent for a while). SMACK-141 git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@3968 b35dd754-fafc-0310-a699-88a17e54d16e --- source/org/jivesoftware/smack/PacketWriter.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/source/org/jivesoftware/smack/PacketWriter.java b/source/org/jivesoftware/smack/PacketWriter.java index cbfc6be53..76228753a 100644 --- a/source/org/jivesoftware/smack/PacketWriter.java +++ b/source/org/jivesoftware/smack/PacketWriter.java @@ -20,12 +20,15 @@ package org.jivesoftware.smack; -import java.util.*; -import java.io.*; - import org.jivesoftware.smack.filter.PacketFilter; import org.jivesoftware.smack.packet.Packet; +import java.io.IOException; +import java.io.Writer; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + /** * Writes packets to a XMPP server. Packets are sent using a dedicated thread. Packet * interceptors can be registered to dynamically modify packets before they're actually @@ -432,6 +435,12 @@ class PacketWriter { } public void run() { + try { + // Sleep 15 seconds before sending first heartbeat. This will give time to + // properly finish TLS negotiation and then start sending heartbeats. + Thread.sleep(15000); + } + catch (InterruptedException ie) { } while (!done) { synchronized (writer) { try {