summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--FTPClient.cpp3
-rw-r--r--FTPCommon.h2
-rw-r--r--FTPServer.cpp6
-rw-r--r--FTPServer.h1
4 files changed, 6 insertions, 6 deletions
diff --git a/FTPClient.cpp b/FTPClient.cpp
index 84c4fdb..c498ed0 100644
--- a/FTPClient.cpp
+++ b/FTPClient.cpp
@@ -160,15 +160,14 @@ void FTPClient::handleFTP()
millisBeginTrans = millis();
bytesTransfered = 0;
ftpState = cTransfer;
+ allocateBuffer(4 * TCP_MSS);
if (_direction & FTP_PUT_NONBLOCKING)
{
CLIENT_SEND("STOR %s", _remoteFileName.c_str());
- allocateBuffer(file.size());
}
else if (_direction & FTP_GET_NONBLOCKING)
{
CLIENT_SEND("RETR %s", _remoteFileName.c_str());
- allocateBuffer(2048);
}
}
}
diff --git a/FTPCommon.h b/FTPCommon.h
index 9b3fb29..edb9d8b 100644
--- a/FTPCommon.h
+++ b/FTPCommon.h
@@ -7,6 +7,8 @@
#include <WString.h>
#include <PolledTimeout.h>
+#define FTP_SERVER_VERSION "0.9.7-20200529"
+
#define FTP_CTRL_PORT 21 // Command port on which server is listening
#define FTP_DATA_PORT_PASV 50009 // Data port in passive mode
#define FTP_TIME_OUT 5 // Disconnect client after 5 minutes of inactivity
diff --git a/FTPServer.cpp b/FTPServer.cpp
index e153649..86adcdb 100644
--- a/FTPServer.cpp
+++ b/FTPServer.cpp
@@ -754,9 +754,9 @@ int8_t FTPServer::processCommand()
millisBeginTrans = millis();
bytesTransfered = 0;
uint32_t fs = file.size();
- if (allocateBuffer(fs > 32768 ? 32768 : fs))
+ if (allocateBuffer(4 * TCP_MSS))
{
- FTP_DEBUG_MSG("Sending file '%s'", path.c_str());
+ FTP_DEBUG_MSG("Sending file '%s' (%lu bytes)", path.c_str(), fs);
FTP_SEND_MSG(150, "%lu bytes to download", fs);
}
else
@@ -801,7 +801,7 @@ int8_t FTPServer::processCommand()
transferState = tStore;
millisBeginTrans = millis();
bytesTransfered = 0;
- if (allocateBuffer(2048))
+ if (allocateBuffer(4 * TCP_MSS))
{
FTP_DEBUG_MSG("Receiving file '%s' => %s", parameters.c_str(), path.c_str());
FTP_SEND_MSG(150, "Connected to port %d", dataPort);
diff --git a/FTPServer.h b/FTPServer.h
index 84e20a7..e0f7913 100644
--- a/FTPServer.h
+++ b/FTPServer.h
@@ -30,7 +30,6 @@
** **
*******************************************************************************/
#include "FTPCommon.h"
-#define FTP_SERVER_VERSION "0.9.7-20200529"
class FTPServer : public FTPCommon
{