Interrupt message load thread on client connection exception

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2119 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2013-05-14 21:01:43 +00:00
parent b55a273921
commit 3189afaae9
1 changed files with 10 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import org.apache.log4j.Logger;
import javax.mail.MessagingException;
import java.io.IOException;
import java.io.OutputStream;
import java.net.SocketException;
/**
* Message load thread.
@ -56,8 +57,15 @@ public class MessageLoadThread extends Thread {
while (!messageLoadThread.isComplete) {
messageLoadThread.join(10000);
LOGGER.debug("Still loading uid " + message.getUid() + " imapUid " + message.getImapUid());
outputStream.write(' ');
outputStream.flush();
try {
outputStream.write(' ');
outputStream.flush();
} catch (SocketException e) {
// client closed connection, stop thread
message.dropMimeMessage();
messageLoadThread.interrupt();
throw e;
}
}
if (messageLoadThread.ioException != null) {
throw messageLoadThread.ioException;