Fix issue on write error

This commit is contained in:
Mimmo La Fauci 2012-06-07 00:55:35 +02:00
parent 970dd043ce
commit 28df8dc4b1
2 changed files with 10 additions and 5 deletions

View File

@ -70,12 +70,17 @@ size_t WiFiClient::write(const uint8_t *buf, size_t size) {
}
if ((!ServerDrv::sendData(_sock, buf, size)) ||
(!ServerDrv::checkDataSent(_sock)))
if (!ServerDrv::sendData(_sock, buf, size))
{
setWriteError();
return 0;
}
if (!ServerDrv::checkDataSent(_sock))
{
setWriteError();
return 0;
}
return size;
}

View File

@ -226,8 +226,8 @@ bool ServerDrv::sendData(uint8_t sock, const uint8_t *data, uint16_t len)
uint8_t ServerDrv::checkDataSent(uint8_t sock)
{
const uint16_t TIMEOUT_DATA_SENT = 250;
static uint16_t timeout = 0;
const uint16_t TIMEOUT_DATA_SENT = 25;
uint16_t timeout = 0;
uint8_t _data = 0;
uint8_t _dataLen = 0;
@ -250,7 +250,7 @@ uint8_t ServerDrv::checkDataSent(uint8_t sock)
if (_data) timeout = 0;
else{
++timeout;
delay(10);
delay(100);
}
}while((_data==0)&&(timeout<TIMEOUT_DATA_SENT));