Skip to content

Commit f450c59

Browse files
committed
EthernetClient::_currentBlock - revert to Norbert's version
1 parent b6dfa0f commit f450c59

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/EthernetClient.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ UIPClient::write(const uint8_t *buf, size_t size)
170170
UIPEthernetClass::tick();
171171
if (u && u->state && !(u->state & (UIP_CLIENT_CLOSE | UIP_CLIENT_REMOTECLOSED)))
172172
{
173-
uint8_t p = _currentBlock(u->packets_out, u->out_pos);
173+
uint8_t p = _currentBlock(u->packets_out);
174174
if (u->packets_out[p] == NOBLOCK)
175175
{
176176
newpacket:
@@ -240,7 +240,7 @@ UIPClient::availableForWrite()
240240
UIPEthernetClass::tick();
241241
if (data->packets_out[0] == NOBLOCK)
242242
return MAX_AVAILABLE;
243-
uint8_t p = _currentBlock(data->packets_out, data->out_pos);
243+
uint8_t p = _currentBlock(data->packets_out);
244244
int used = UIP_SOCKET_DATALEN * p + data->out_pos;
245245
return MAX_AVAILABLE - used;
246246
}
@@ -542,18 +542,12 @@ UIPClient::_allocateData()
542542
}
543543

544544
uint8_t
545-
UIPClient::_currentBlock(memhandle* block, uint16_t out_pos)
545+
UIPClient::_currentBlock(memhandle* block)
546546
{
547-
if (block[0] == NOBLOCK)
548-
return 0;
549547
for (uint8_t i = 1; i < UIP_SOCKET_NUMPACKETS; i++)
550548
{
551549
if (block[i] == NOBLOCK)
552-
{
553-
if (out_pos == Enc28J60Network::blockSize(block[i-1])) // block is full
554-
return i;
555550
return i-1;
556-
}
557551
}
558552
return UIP_SOCKET_NUMPACKETS-1;
559553
}

src/EthernetClient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class EthernetClient : public Client {
8787
static uip_userdata_t all_data[UIP_CONNS];
8888
static uip_userdata_t* _allocateData();
8989

90-
static uint8_t _currentBlock(memhandle* blocks, uint16_t out_pos);
90+
static uint8_t _currentBlock(memhandle* blocks);
9191
static void _eatBlock(memhandle* blocks);
9292
static void _flushBlocks(memhandle* blocks);
9393

0 commit comments

Comments
 (0)