Skip to content

Commit 2691249

Browse files
committed
Applying clang formatting
1 parent 7bfbb94 commit 2691249

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

src/AsyncTCP.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ extern "C" {
6565
TCP poll interval is specified in terms of the TCP coarse timer interval, which is called twice a second
6666
https://github.com/espressif/esp-lwip/blob/2acf959a2bb559313cd2bf9306c24612ba3d0e19/src/core/tcp.c#L1895
6767
*/
68-
#define CONFIG_ASYNC_TCP_POLL_TIMER 1
68+
#define CONFIG_ASYNC_TCP_POLL_TIMER 1
6969

7070
/*
7171
* TCP/IP Event Task
@@ -179,9 +179,9 @@ static inline bool _get_async_event(lwip_event_packet_t** e) {
179179
todo: implement some kind of fair dequeing or (better) simply punish user for a bad designed callbacks by resetting hog connections
180180
*/
181181
lwip_event_packet_t* next_pkt = NULL;
182-
while (xQueuePeek(_async_queue, &next_pkt, 0) == pdPASS){
183-
if (next_pkt->arg == (*e)->arg && next_pkt->event == LWIP_TCP_POLL){
184-
if (xQueueReceive(_async_queue, &next_pkt, 0) == pdPASS){
182+
while (xQueuePeek(_async_queue, &next_pkt, 0) == pdPASS) {
183+
if (next_pkt->arg == (*e)->arg && next_pkt->event == LWIP_TCP_POLL) {
184+
if (xQueueReceive(_async_queue, &next_pkt, 0) == pdPASS) {
185185
free(next_pkt);
186186
next_pkt = NULL;
187187
log_d("coalescing polls, network congestion or async callbacks might be too slow!");
@@ -225,7 +225,7 @@ static bool _remove_events_with_arg(void* arg) {
225225
free(first_packet);
226226
first_packet = NULL;
227227

228-
// try to return first packet to the back of the queue
228+
// try to return first packet to the back of the queue
229229
} else if (xQueueSend(_async_queue, &first_packet, 0) != pdPASS) {
230230
// we can't wait here if queue is full, because this call has been done from the only consumer task of this queue
231231
// otherwise it would deadlock, we have to discard the event
@@ -374,7 +374,7 @@ static int8_t _tcp_connected(void* arg, tcp_pcb* pcb, int8_t err) {
374374

375375
static int8_t _tcp_poll(void* arg, struct tcp_pcb* pcb) {
376376
// throttle polling events queing when event queue is getting filled up, let it handle _onack's
377-
//log_d("qs:%u", uxQueueMessagesWaiting(_async_queue));
377+
// log_d("qs:%u", uxQueueMessagesWaiting(_async_queue));
378378
if (uxQueueMessagesWaiting(_async_queue) > (rand() % CONFIG_ASYNC_TCP_QUEUE_SIZE / 2 + CONFIG_ASYNC_TCP_QUEUE_SIZE / 4)) {
379379
log_d("throttling");
380380
return ERR_OK;

src/AsyncTCP.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ extern "C" {
5757

5858
// guard AsyncTCP task with watchdog
5959
#ifndef CONFIG_ASYNC_TCP_USE_WDT
60-
#define CONFIG_ASYNC_TCP_USE_WDT 1
60+
#define CONFIG_ASYNC_TCP_USE_WDT 1
6161
#endif
6262

6363
#ifndef CONFIG_ASYNC_TCP_STACK_SIZE
@@ -111,12 +111,12 @@ class AsyncClient {
111111
bool connect(const char* host, uint16_t port);
112112
/**
113113
* @brief close connection
114-
*
114+
*
115115
* @param now - ignored
116116
*/
117117
void close(bool now = false);
118118
// same as close()
119-
void stop(){ close(false); };
119+
void stop() { close(false); };
120120
int8_t abort();
121121
bool free();
122122

@@ -134,17 +134,17 @@ class AsyncClient {
134134
it is enforced in https://github.com/espressif/esp-lwip/blob/0606eed9d8b98a797514fdf6eabb4daf1c8c8cd9/src/core/tcp_out.c#L422C5-L422C30
135135
if LWIP_NETIF_TX_SINGLE_PBUF is set, and it is set indeed in IDF
136136
https://github.com/espressif/esp-idf/blob/a0f798cfc4bbd624aab52b2c194d219e242d80c1/components/lwip/port/include/lwipopts.h#L744
137-
*
138-
* @param data
139-
* @param size
140-
* @param apiflags
137+
*
138+
* @param data
139+
* @param size
140+
* @param apiflags
141141
* @return size_t amount of data that has been copied
142142
*/
143143
size_t add(const char* data, size_t size, uint8_t apiflags = ASYNC_WRITE_FLAG_COPY);
144144

145145
/**
146146
* @brief send data previously add()'ed
147-
*
147+
*
148148
* @return true on success
149149
* @return false on error
150150
*/
@@ -154,22 +154,22 @@ class AsyncClient {
154154
* @brief add and enqueue data for sending
155155
* @note it is same as add() + send()
156156
* @note only make sense when canSend() == true
157-
*
158-
* @param data
159-
* @param size
160-
* @param apiflags
161-
* @return size_t
157+
*
158+
* @param data
159+
* @param size
160+
* @param apiflags
161+
* @return size_t
162162
*/
163163
size_t write(const char* data, size_t size, uint8_t apiflags = ASYNC_WRITE_FLAG_COPY);
164164

165165
/**
166166
* @brief add and enque data for sending
167167
* @note treats data as null-terminated string
168-
*
169-
* @param data
170-
* @return size_t
168+
*
169+
* @param data
170+
* @return size_t
171171
*/
172-
size_t write(const char* data){ return data == NULL ? 0 : write(data, strlen(data)); };
172+
size_t write(const char* data) { return data == NULL ? 0 : write(data, strlen(data)); };
173173

174174
uint8_t state();
175175
bool connecting();

0 commit comments

Comments
 (0)