Skip to content

Commit f61c4dc

Browse files
committed
Deprecate the old close(bool) call
1 parent 42f4f71 commit f61c4dc

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

examples/Client/Client.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void makeRequest() {
3131

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

@@ -41,7 +41,7 @@ void makeRequest() {
4141

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

4747
permits++;

idf_component_examples/client/main/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void makeRequest() {
2828

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

3939
client->onDisconnect([](void *arg, AsyncClient *client) {
4040
Serial.printf("** client has been disconnected: %" PRIu16 "\n", client->localPort());
41-
client->close(true);
41+
client->close();
4242
delete client;
4343
client_running = false;
4444
});

src/AsyncTCP.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ bool AsyncClient::connect(const char *host, uint16_t port) {
921921
return false;
922922
}
923923

924-
void AsyncClient::close(bool now) {
924+
void AsyncClient::close() {
925925
if (_pcb) {
926926
_tcp_recved(&_pcb, _rx_ack_len);
927927
}

src/AsyncTCP.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,26 @@ class AsyncClient {
9999
#endif
100100
#endif
101101
bool connect(const char *host, uint16_t port);
102+
102103
/**
103104
* @brief close connection
104105
*
105106
* @param now - ignored
106107
*/
107-
void close(bool now = false);
108-
// same as close()
108+
[[deprecated("Use AsyncClient::close() instead")]]
109+
void close(bool now) {
110+
close();
111+
}
112+
[[deprecated("Use AsyncClient::close() instead")]]
109113
void stop() {
110-
close(false);
114+
close();
111115
};
116+
117+
/**
118+
* @brief close connection
119+
*/
120+
void close();
121+
112122
int8_t abort();
113123
bool free();
114124

0 commit comments

Comments
 (0)