summaryrefslogtreecommitdiffstats
path: root/FTPCommon.h
diff options
context:
space:
mode:
authorDaniel Plasa <dplasa@gmail.com>2020-05-31 14:43:26 +0200
committerDaniel Plasa <dplasa@gmail.com>2020-05-31 14:43:26 +0200
commit5094cb3c168ed5c08dbdaa982fe1c096482c5ecc (patch)
tree618593e64517b17b3e2876c12a71e11c6f76d855 /FTPCommon.h
parentdescribe limited use of FuseFS clients (diff)
downloadFTPCLientServer-5094cb3c168ed5c08dbdaa982fe1c096482c5ecc.tar
FTPCLientServer-5094cb3c168ed5c08dbdaa982fe1c096482c5ecc.tar.gz
FTPCLientServer-5094cb3c168ed5c08dbdaa982fe1c096482c5ecc.tar.bz2
FTPCLientServer-5094cb3c168ed5c08dbdaa982fe1c096482c5ecc.tar.lz
FTPCLientServer-5094cb3c168ed5c08dbdaa982fe1c096482c5ecc.tar.xz
FTPCLientServer-5094cb3c168ed5c08dbdaa982fe1c096482c5ecc.tar.zst
FTPCLientServer-5094cb3c168ed5c08dbdaa982fe1c096482c5ecc.zip
Diffstat (limited to 'FTPCommon.h')
-rw-r--r--FTPCommon.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/FTPCommon.h b/FTPCommon.h
index edb9d8b..a88dd8d 100644
--- a/FTPCommon.h
+++ b/FTPCommon.h
@@ -5,7 +5,18 @@
#include <FS.h>
#include <WiFiClient.h>
#include <WString.h>
+
+#ifdef ESP8266
#include <PolledTimeout.h>
+using esp8266::polledTimeout::oneShotMs; // import the type to the local namespace
+#define BUFFERSIZE TCP_MSS
+#define PRINTu32 "lu"
+#elif defined ESP32
+#include "esp32compat/PolledTimeout.h"
+using esp32::polledTimeout::oneShotMs;
+#define BUFFERSIZE CONFIG_TCP_MSS
+#define PRINTu32 "u"
+#endif
#define FTP_SERVER_VERSION "0.9.7-20200529"
@@ -84,8 +95,6 @@
#define FTP_CMD_LE_SYST 0x54535953 // "SYST" as uint32_t (little endian)
#define FTP_CMD_BE_SYST 0x53595354 // "SYST" as uint32_t (big endian)
-using esp8266::polledTimeout::oneShotMs; // import the type to the local namespace
-
class FTPCommon
{
public:
@@ -124,7 +133,7 @@ protected:
bool doNetworkToFile();
virtual void closeTransfer();
- uint16_t allocateBuffer(uint16_t desiredBytes); // allocate buffer for transfer
+ uint16_t allocateBuffer(uint16_t desiredBytes = BUFFERSIZE); // allocate buffer for transfer
void freeBuffer();
uint8_t *fileBuffer = NULL; // pointer to buffer for file transfer (by allocateBuffer)
uint16_t fileBufferSize; // size of buffer