Skip to content

Commit 47e14ed

Browse files
committed
Fix filesystem was not mount before file removing issue and update TCP client.
1 parent 327792b commit 47e14ed

File tree

7 files changed

+26
-25
lines changed

7 files changed

+26
-25
lines changed

src/Firebase_ESP_Client.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*
1212
* Updates:
1313
* - Fix filesystem was not mount before file removing issue.
14+
* - Update TCP client.
1415
*
1516
*
1617
* This work is a part of Firebase ESP Client library

src/gcs/GCS.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
2-
* Google's Cloud Storage class, GCS.cpp version 1.2.0
2+
* Google's Cloud Storage class, GCS.cpp version 1.2.1
33
*
44
* This library supports Espressif ESP8266 and ESP32
55
*
6-
* Created November 8, 2022
6+
* Created November 10, 2022
77
*
88
* This work is a part of Firebase ESP Client library
99
* Copyright (c) 2022 K. Suwatchai (Mobizt)
@@ -1970,6 +1970,9 @@ bool GG_CloudStorage::handleResponse(FirebaseData *fbdo, struct fb_esp_gcs_req_t
19701970
payloadRead += available;
19711971
}
19721972

1973+
if (payloadRead == response.contentLen)
1974+
break;
1975+
19731976
available = fbdo->tcpClient.available();
19741977
}
19751978

src/gcs/GCS.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
2-
* Google's Cloud Storage class, GCS.h version 1.2.0
2+
* Google's Cloud Storage class, GCS.h version 1.2.1
33
*
44
* This library supports Espressif ESP8266 and ESP32
55
*
6-
* Created November 8, 2022
6+
* Created November 10, 2022
77
*
88
* This work is a part of Firebase ESP Client library
99
* Copyright (c) 2022 K. Suwatchai (Mobizt)

src/mbfs/MB_FS.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* The MB_FS, filesystems wrapper class v1.0.9.
2+
* The MB_FS, filesystems wrapper class v1.0.9
33
*
44
* This wrapper class is for SD and Flash filesystems interface which supports SdFat (//https://github.com/greiman/SdFat)
55
*
@@ -624,6 +624,9 @@ class MB_FS
624624
bool existed(const MB_String &filename, mbfs_file_type type)
625625
{
626626

627+
if (!checkStorageReady(type))
628+
return false;
629+
627630
#if defined(MBFS_FLASH_FS)
628631
if (type == mbfs_flash)
629632
return MBFS_FLASH_FS.exists(filename.c_str());
@@ -692,6 +695,8 @@ class MB_FS
692695

693696
bool remove(const MB_String &filename, mbfs_file_type type)
694697
{
698+
if (!checkStorageReady(type))
699+
return false;
695700

696701
#if defined(MBFS_FLASH_FS)
697702
if (type == mbfs_flash && !flashReady())

src/storage/FCS.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
2-
* Google's Firebase Storage class, FCS.cpp version 1.1.25
2+
* Google's Firebase Storage class, FCS.cpp version 1.2.1
33
*
44
* This library supports Espressif ESP8266 and ESP32
55
*
6-
* Created November 7, 2022
6+
* Created November 10, 2022
77
*
88
* This work is a part of Firebase ESP Client library
99
* Copyright (c) 2021 K. Suwatchai (Mobizt)
@@ -701,7 +701,7 @@ bool FB_Storage::handleResponse(FirebaseData *fbdo, struct fb_esp_fcs_req_t *req
701701
// We have to remove existing file
702702
ut->mbfs->remove(req->localFileName, mbfs_type req->storageType);
703703
#else
704-
int ret = ut->mbfs->open(req->localFileName, mbfs_type req->storageType, mb_fs_open_mode_write);
704+
int ret = ut->mbfs->open(req->localFileName, mbfs_type req->storageType, mb_fs_open_mode_write);
705705

706706
if (ret < 0)
707707
{
@@ -919,6 +919,9 @@ bool FB_Storage::handleResponse(FirebaseData *fbdo, struct fb_esp_fcs_req_t *req
919919
payloadRead += available;
920920
}
921921

922+
if (payloadRead == response.contentLen)
923+
break;
924+
922925
available = fbdo->tcpClient.available();
923926
}
924927

src/storage/FCS.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
2-
* Google's Firebase Storage class, FCS.h version 1.2.0
2+
* Google's Firebase Storage class, FCS.h version 1.2.1
33
*
44
* This library supports Espressif ESP8266 and ESP32
55
*
6-
* Created November 8, 2022
6+
* Created November 10, 2022
77
*
88
* This work is a part of Firebase ESP Client library
99
* Copyright (c) 2022 K. Suwatchai (Mobizt)

src/wcs/base/FB_TCP_Client_Base.h

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
* TCP Client Base class, version 1.0.7
2+
* TCP Client Base class, version 1.0.8
33
*
4-
* Created November 1, 2022
4+
* Created November 10, 2022
55
*
66
* The MIT License (MIT)
77
* Copyright (c) 2022 K. Suwatchai (Mobizt)
@@ -127,24 +127,13 @@ class FB_TCP_Client_Base
127127
if (!client)
128128
return;
129129

130-
if (connected())
131-
return client->stop();
130+
return client->stop();
132131
};
133132

134133
virtual bool connected()
135134
{
136135
if (client)
137-
{
138-
bool ret = client->connected();
139-
140-
if (!ret)
141-
{
142-
client->stop();
143-
client->flush();
144-
}
145-
146-
return ret;
147-
}
136+
return client->connected();
148137

149138
return false;
150139
}

0 commit comments

Comments
 (0)