From 094318dacbb478de4c4a403b4ebce2bfe65f75f9 Mon Sep 17 00:00:00 2001 From: Joe Steele Date: Sat, 1 Mar 2014 17:19:36 -0500 Subject: [PATCH] Use buffered output streams for all output POP3 already does this. This is a more general solution to the problem addressed in commit 8bfd6ca. --- src/com/fsck/k9/mail/store/ImapStore.java | 6 ++---- src/com/fsck/k9/mail/transport/SmtpTransport.java | 7 +++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index d52e78c71..3a28951c7 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -2450,7 +2450,7 @@ public class ImapStore extends Store { mIn = new PeekableInputStream(new BufferedInputStream(mSocket.getInputStream(), 1024)); mParser = new ImapResponseParser(mIn); - mOut = mSocket.getOutputStream(); + mOut = new BufferedOutputStream(mSocket.getOutputStream(), 1024); capabilities.clear(); ImapResponse nullResponse = mParser.readResponse(); @@ -2488,7 +2488,7 @@ public class ImapStore extends Store { mIn = new PeekableInputStream(new BufferedInputStream(mSocket .getInputStream(), 1024)); mParser = new ImapResponseParser(mIn); - mOut = mSocket.getOutputStream(); + mOut = new BufferedOutputStream(mSocket.getOutputStream(), 1024); // Per RFC 2595 (3.1): Once TLS has been started, reissue CAPABILITY command if (K9.DEBUG) Log.i(K9.LOG_TAG, "Updating capabilities after STARTTLS for " + getLogId()); @@ -2511,8 +2511,6 @@ public class ImapStore extends Store { } } - mOut = new BufferedOutputStream(mOut, 1024); - switch (mSettings.getAuthType()) { case CRAM_MD5: if (hasCapability(CAPABILITY_AUTH_CRAM_MD5)) { diff --git a/src/com/fsck/k9/mail/transport/SmtpTransport.java b/src/com/fsck/k9/mail/transport/SmtpTransport.java index dc8a5e8c9..adce9b181 100644 --- a/src/com/fsck/k9/mail/transport/SmtpTransport.java +++ b/src/com/fsck/k9/mail/transport/SmtpTransport.java @@ -229,7 +229,7 @@ public class SmtpTransport extends Transport { mSocket.setSoTimeout(SOCKET_READ_TIMEOUT); mIn = new PeekableInputStream(new BufferedInputStream(mSocket.getInputStream(), 1024)); - mOut = mSocket.getOutputStream(); + mOut = new BufferedOutputStream(mSocket.getOutputStream(), 1024); // Eat the banner executeSimpleCommand(null); @@ -270,7 +270,7 @@ public class SmtpTransport extends Transport { mPort, true); mIn = new PeekableInputStream(new BufferedInputStream(mSocket.getInputStream(), 1024)); - mOut = mSocket.getOutputStream(); + mOut = new BufferedOutputStream(mSocket.getOutputStream(), 1024); /* * Now resend the EHLO. Required by RFC2487 Sec. 5.2, and more specifically, * Exim. @@ -493,8 +493,7 @@ public class SmtpTransport extends Transport { executeSimpleCommand("DATA"); EOLConvertingOutputStream msgOut = new EOLConvertingOutputStream( - new LineWrapOutputStream(new SmtpDataStuffing( - new BufferedOutputStream(mOut, 1024)), 1000)); + new LineWrapOutputStream(new SmtpDataStuffing(mOut), 1000)); message.writeTo(msgOut);