Skip to content

Commit

Permalink
Update Core.
Browse files Browse the repository at this point in the history
  • Loading branch information
mobizt committed Jan 29, 2024
1 parent 27e5e9d commit 319a1fc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
15 changes: 2 additions & 13 deletions src/core/AsyncClient/AsyncClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ class AsyncClient
network_config_data net;
uint32_t addr = 0;
bool inProcess = false;
// should be removed
String token;

void closeFile(async_data_item_t *sData)
{
Expand Down Expand Up @@ -459,6 +457,7 @@ class AsyncClient
if (setData || error_notify_timeout)
{
*sData->refResult = sData->aResult;

if (setData)
sData->refResult->setPayload(sData->aResult.data_payload);
}
Expand Down Expand Up @@ -595,6 +594,7 @@ class AsyncClient

if (sData->response.flags.sse || !sData->response.flags.payload_remaining)
{

sData->aResult.setPayload(sData->response.payload);

if (sData->aResult.download_data.total > 0)
Expand Down Expand Up @@ -1651,12 +1651,6 @@ class AsyncClient
return url_info.host;
}

// should be removed
String getToken()
{
return token;
}

public:
AsyncClient(Client &client, network_config_data &net) : client(&client)
{
Expand Down Expand Up @@ -1704,11 +1698,6 @@ class AsyncClient
client->stop();
}

void setAuth(const String &auth)
{
this->token = auth;
}

FirebaseError lastError() { return lastErr; }
};

Expand Down
2 changes: 1 addition & 1 deletion src/core/AsyncClient/ResponseHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <Arduino.h>
#include <Client.h>

#define FIREBASE_TCP_READ_TIMEOUT 60 * 1000;
#define FIREBASE_TCP_READ_TIMEOUT 30 * 1000

struct async_response_handler_t
{
Expand Down
4 changes: 4 additions & 0 deletions src/core/AuthRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ class AuthRequest
{
private:
AsyncClient::async_data_item_t *sData = nullptr;


public:
AuthRequest(){};
~AuthRequest(){};

unsigned long request_sent_ms = 0;

void asyncRequest(AsyncClient *aClient, const String &subdomain, const String &extras, const String &payload, AsyncResult &aResult)
{
String host;
Expand All @@ -49,6 +52,7 @@ class AuthRequest
aClient->setContentLength(sData, sData->request.payload.length());
sData->refResult = &aResult;
sData->ref_result_addr = aResult.addr;
request_sent_ms = millis();
aClient->process(sData->async);
aClient->handleRemove();
}
Expand Down
3 changes: 2 additions & 1 deletion src/core/FirebaseApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,8 @@ namespace firebase

if (auth_data.user_auth.status._event == auth_event_auth_request_sent)
{
if (aResult.error().code() > 0)

if (aResult.error().code() > 0 || millis() - authReq.request_sent_ms > FIREBASE_TCP_READ_TIMEOUT)
{
setEvent(auth_event_error);
return false;
Expand Down

0 comments on commit 319a1fc

Please sign in to comment.