Skip to content

Commit f22ec8b

Browse files
committed
EthernetClient - efficient transmitting without UIP_CLIENT_TIMER
simply send waiting packet right after ACK for the previous
1 parent 1c13fd9 commit f22ec8b

File tree

4 files changed

+2
-40
lines changed

4 files changed

+2
-40
lines changed

src/Ethernet.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -237,37 +237,14 @@ UIPEthernetClass::tick()
237237

238238
unsigned long now = millis();
239239

240-
#if UIP_CLIENT_TIMER >= 0
241-
boolean periodic = (long)( now - periodic_timer ) >= 0;
242-
for (int i = 0; i < UIP_CONNS; i++)
243-
{
244-
#else
245240
if ((long)( now - periodic_timer ) >= 0)
246241
{
247242
periodic_timer = now + UIP_PERIODIC_TIMER;
248243

249244
for (int i = 0; i < UIP_CONNS; i++)
250245
{
251-
#endif
252246
uip_conn = &uip_conns[i];
253-
#if UIP_CLIENT_TIMER >= 0
254-
if (periodic)
255-
{
256-
#endif
257247
uip_process(UIP_TIMER);
258-
#if UIP_CLIENT_TIMER >= 0
259-
}
260-
else
261-
{
262-
if (uip_conn->appstate != NULL && (long)( now - ((uip_userdata_t*)uip_conn->appstate)->timer) >= 0)
263-
{
264-
uip_process(UIP_POLL_REQUEST);
265-
((uip_userdata_t*)uip_conn->appstate)->timer = millis() + UIP_CLIENT_TIMER;
266-
}
267-
else
268-
continue;
269-
}
270-
#endif
271248
// If the above function invocation resulted in data that
272249
// should be sent out on the Enc28J60Network, the global variable
273250
// uip_len is set to a value > 0.
@@ -277,11 +254,6 @@ UIPEthernetClass::tick()
277254
network_send();
278255
}
279256
}
280-
#if UIP_CLIENT_TIMER >= 0
281-
if (periodic)
282-
{
283-
periodic_timer = now + UIP_PERIODIC_TIMER;
284-
#endif
285257
#if UIP_UDP
286258
for (int i = 0; i < UIP_UDP_CONNS; i++)
287259
{

src/EthernetClient.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,6 @@ UIPClient::_write(uip_userdata_t* u, const uint8_t *buf, size_t size)
223223
goto newpacket;
224224
}
225225
ready:
226-
#if UIP_CLIENT_TIMER >= 0
227-
u->timer = millis()+UIP_CLIENT_TIMER;
228-
#endif
229226
return size-remain;
230227
}
231228
return 0;
@@ -442,12 +439,14 @@ uipclient_appcall(void)
442439
UIPClient::_eatBlock(u->packets_out);
443440
if (u->packets_out[0] == NOBLOCK)
444441
u->state &= ~UIP_CLIENT_FLUSH;
442+
goto send;
445443
}
446444
if (uip_poll() || uip_rexmit())
447445
{
448446
#ifdef UIPETHERNET_DEBUG_CLIENT
449447
//Serial.println(F("UIPClient uip_poll"));
450448
#endif
449+
send:
451450
if (u->packets_out[0] != NOBLOCK)
452451
{
453452
if (u->packets_out[1] == NOBLOCK)

src/EthernetClient.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ typedef struct {
4949
memhandle packets_in[UIP_SOCKET_NUMPACKETS] = {NOBLOCK};
5050
memhandle packets_out[UIP_SOCKET_NUMPACKETS] = {NOBLOCK};
5151
memaddress out_pos;
52-
#if UIP_CLIENT_TIMER >= 0
53-
unsigned long timer;
54-
#endif
5552
} uip_userdata_t;
5653

5754
class EthernetClient : public Client {

src/utility/uipethernet-conf.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,4 @@
3535
#define UIP_PERIODIC_TIMER 100
3636
#endif
3737

38-
/* timer to poll client for data after last write (in ms)
39-
* set to -1 to disable fast polling and rely on periodic only (saves 100 bytes flash) */
40-
#ifndef UIP_CLIENT_TIMER
41-
#define UIP_CLIENT_TIMER 10
42-
#endif
43-
4438
#endif

0 commit comments

Comments
 (0)