Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/Client/Client.ino
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void makeRequest() {

client->onError([](void *arg, AsyncClient *client, int8_t error) {
Serial.printf("** error occurred %s \n", client->errorToString(error));
client->close(true);
client->close();
delete client;
});

Expand All @@ -41,7 +41,7 @@ void makeRequest() {

client->onDisconnect([](void *arg, AsyncClient *client) {
Serial.printf("** client has been disconnected: %" PRIu16 "\n", client->localPort());
client->close(true);
client->close();
delete client;

permits++;
Expand Down
4 changes: 2 additions & 2 deletions idf_component_examples/client/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void makeRequest() {

client->onError([](void *arg, AsyncClient *client, int8_t error) {
Serial.printf("** error occurred %s \n", client->errorToString(error));
client->close(true);
client->close();
delete client;
client_running = false;
});
Expand All @@ -38,7 +38,7 @@ void makeRequest() {

client->onDisconnect([](void *arg, AsyncClient *client) {
Serial.printf("** client has been disconnected: %" PRIu16 "\n", client->localPort());
client->close(true);
client->close();
delete client;
client_running = false;
});
Expand Down
2 changes: 1 addition & 1 deletion src/AsyncTCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ bool AsyncClient::connect(const char *host, uint16_t port) {
return false;
}

void AsyncClient::close(bool now) {
void AsyncClient::close() {
if (_pcb) {
_tcp_recved(&_pcb, _rx_ack_len);
}
Expand Down
16 changes: 13 additions & 3 deletions src/AsyncTCP.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,26 @@ class AsyncClient {
#endif
#endif
bool connect(const char *host, uint16_t port);

/**
* @brief close connection
*
* @param now - ignored
*/
void close(bool now = false);
// same as close()
[[deprecated("Use AsyncClient::close() instead")]]
void close(bool now) {
close();
}
[[deprecated("Use AsyncClient::close() instead")]]
void stop() {
close(false);
close();
};

/**
* @brief close connection
*/
void close();

int8_t abort();
bool free();

Expand Down