0
0
mirror of https://github.com/thunderbird/thunderbird-android.git synced 2024-09-19 19:52:14 +02:00

SMTP: Increase socket read timeout for the DATA command

This commit is contained in:
cketti 2022-07-19 12:09:27 +02:00
parent 74a58345d8
commit 8c556a4af8

View File

@ -39,6 +39,8 @@ import java.util.Locale
import javax.net.ssl.SSLException
import org.apache.commons.io.IOUtils
private const val SOCKET_SEND_MESSAGE_READ_TIMEOUT = 5 * 60 * 1000 // 5 minutes
private const val SMTP_CONTINUE_REQUEST = 334
private const val SMTP_AUTHENTICATION_FAILURE_ERROR_CODE = 535
@ -111,7 +113,6 @@ class SmtpTransport(
val socket = this.socket ?: error("socket == null")
// RFC 1047
socket.soTimeout = SOCKET_READ_TIMEOUT
inputStream = PeekableInputStream(BufferedInputStream(socket.getInputStream(), 1024))
@ -390,6 +391,11 @@ class SmtpTransport(
executeCommand("DATA")
// Sending large messages might take a long time. We're using an extended timeout while waiting for the
// final response to the DATA command.
val socket = this.socket ?: error("socket == null")
socket.soTimeout = SOCKET_SEND_MESSAGE_READ_TIMEOUT
val msgOut = EOLConvertingOutputStream(
LineWrapOutputStream(
SmtpDataStuffing(outputStream), 1000