@@ -239,7 +239,6 @@ err_t lwipClient::recv_callback(struct tcp_pcb* tpcb, struct pbuf* p, err_t err)
239
239
240
240
return ERR_OK;
241
241
}
242
- arduino::lock ();
243
242
if (this ->tcp_info ->state == TCP_CONNECTED || this ->tcp_info ->state == TCP_ACCEPTED) {
244
243
if (this ->tcp_info ->pbuf_head == nullptr ) {
245
244
// no need to increment the references of the pbuf,
@@ -252,7 +251,6 @@ err_t lwipClient::recv_callback(struct tcp_pcb* tpcb, struct pbuf* p, err_t err)
252
251
253
252
ret_err = ERR_OK;
254
253
}
255
- arduino::unlock ();
256
254
257
255
return ret_err;
258
256
}
@@ -262,7 +260,7 @@ size_t lwipClient::write(uint8_t b) {
262
260
}
263
261
264
262
size_t lwipClient::write (const uint8_t * buffer, size_t size) {
265
- arduino::lock ();
263
+ CLwipIf::getInstance (). syncTimer ();
266
264
267
265
uint8_t * buffer_cursor = (uint8_t *)buffer;
268
266
uint16_t bytes_to_send = 0 ;
@@ -286,7 +284,8 @@ size_t lwipClient::write(const uint8_t* buffer, size_t size) {
286
284
287
285
tcp_output (this ->tcp_info ->pcb );
288
286
289
- arduino::unlock ();
287
+ CLwipIf::getInstance ().enableTimer ();
288
+
290
289
return buffer_cursor - buffer;
291
290
}
292
291
@@ -312,14 +311,14 @@ int lwipClient::read(uint8_t* buffer, size_t size) {
312
311
* meaning that across different calls of this function a pbuf could be partially copied
313
312
* we need to account that
314
313
*/
315
- arduino::lock ();
314
+ CLwipIf::getInstance (). syncTimer ();
316
315
uint16_t copied = pbuf_copy_partial (this ->tcp_info ->pbuf_head , buffer, size, this ->tcp_info ->pbuf_offset );
317
316
318
317
this ->tcp_info ->pbuf_head = free_pbuf_chain (this ->tcp_info ->pbuf_head , copied, &this ->tcp_info ->pbuf_offset );
319
318
320
319
// acknowledge the received data
321
320
tcp_recved (this ->tcp_info ->pcb , copied);
322
- arduino::unlock ();
321
+ CLwipIf::getInstance (). enableTimer ();
323
322
324
323
return copied;
325
324
}
@@ -331,9 +330,9 @@ int lwipClient::peek() {
331
330
return -1 ;
332
331
}
333
332
334
- arduino::lock ();
333
+ CLwipIf::getInstance (). syncTimer ();
335
334
b = pbuf_get_at (this ->tcp_info ->pbuf_head , 0 ); // TODO test this
336
- arduino::unlock ();
335
+ CLwipIf::getInstance (). enableTimer ();
337
336
338
337
return b;
339
338
}
@@ -417,7 +416,7 @@ size_t lwipClient::read_until_token(
417
416
if (buffer_size==0 || buffer==nullptr || this ->tcp_info ->pbuf_head ==nullptr ) {
418
417
return 0 ; // TODO extend checks
419
418
}
420
- arduino::lock ();
419
+ CLwipIf::getInstance (). syncTimer ();
421
420
// TODO check that the buffer size is less than the token len
422
421
423
422
uint16_t offset=this ->tcp_info ->pbuf_offset ;
@@ -456,7 +455,7 @@ size_t lwipClient::read_until_token(
456
455
457
456
// acknowledge the received data
458
457
tcp_recved (this ->tcp_info ->pcb , copied);
459
- arduino::unlock ();
458
+ CLwipIf::getInstance (). enableTimer ();
460
459
461
460
return copied;
462
461
}
0 commit comments