1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-01-31 15:20:09 -05:00

Use buffered output streams for all output

POP3 already does this.

This is a more general solution to the problem
addressed in commit 8bfd6ca.
This commit is contained in:
Joe Steele 2014-03-01 17:19:36 -05:00
parent df3eef0052
commit 094318dacb
2 changed files with 5 additions and 8 deletions

View File

@ -2450,7 +2450,7 @@ public class ImapStore extends Store {
mIn = new PeekableInputStream(new BufferedInputStream(mSocket.getInputStream(), mIn = new PeekableInputStream(new BufferedInputStream(mSocket.getInputStream(),
1024)); 1024));
mParser = new ImapResponseParser(mIn); mParser = new ImapResponseParser(mIn);
mOut = mSocket.getOutputStream(); mOut = new BufferedOutputStream(mSocket.getOutputStream(), 1024);
capabilities.clear(); capabilities.clear();
ImapResponse nullResponse = mParser.readResponse(); ImapResponse nullResponse = mParser.readResponse();
@ -2488,7 +2488,7 @@ public class ImapStore extends Store {
mIn = new PeekableInputStream(new BufferedInputStream(mSocket mIn = new PeekableInputStream(new BufferedInputStream(mSocket
.getInputStream(), 1024)); .getInputStream(), 1024));
mParser = new ImapResponseParser(mIn); 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 // Per RFC 2595 (3.1): Once TLS has been started, reissue CAPABILITY command
if (K9.DEBUG) if (K9.DEBUG)
Log.i(K9.LOG_TAG, "Updating capabilities after STARTTLS for " + getLogId()); 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()) { switch (mSettings.getAuthType()) {
case CRAM_MD5: case CRAM_MD5:
if (hasCapability(CAPABILITY_AUTH_CRAM_MD5)) { if (hasCapability(CAPABILITY_AUTH_CRAM_MD5)) {

View File

@ -229,7 +229,7 @@ public class SmtpTransport extends Transport {
mSocket.setSoTimeout(SOCKET_READ_TIMEOUT); mSocket.setSoTimeout(SOCKET_READ_TIMEOUT);
mIn = new PeekableInputStream(new BufferedInputStream(mSocket.getInputStream(), 1024)); mIn = new PeekableInputStream(new BufferedInputStream(mSocket.getInputStream(), 1024));
mOut = mSocket.getOutputStream(); mOut = new BufferedOutputStream(mSocket.getOutputStream(), 1024);
// Eat the banner // Eat the banner
executeSimpleCommand(null); executeSimpleCommand(null);
@ -270,7 +270,7 @@ public class SmtpTransport extends Transport {
mPort, true); mPort, true);
mIn = new PeekableInputStream(new BufferedInputStream(mSocket.getInputStream(), mIn = new PeekableInputStream(new BufferedInputStream(mSocket.getInputStream(),
1024)); 1024));
mOut = mSocket.getOutputStream(); mOut = new BufferedOutputStream(mSocket.getOutputStream(), 1024);
/* /*
* Now resend the EHLO. Required by RFC2487 Sec. 5.2, and more specifically, * Now resend the EHLO. Required by RFC2487 Sec. 5.2, and more specifically,
* Exim. * Exim.
@ -493,8 +493,7 @@ public class SmtpTransport extends Transport {
executeSimpleCommand("DATA"); executeSimpleCommand("DATA");
EOLConvertingOutputStream msgOut = new EOLConvertingOutputStream( EOLConvertingOutputStream msgOut = new EOLConvertingOutputStream(
new LineWrapOutputStream(new SmtpDataStuffing( new LineWrapOutputStream(new SmtpDataStuffing(mOut), 1000));
new BufferedOutputStream(mOut, 1024)), 1000));
message.writeTo(msgOut); message.writeTo(msgOut);