fix(UML-1780): Уменьшен максимальный размер буфера
This commit is contained in:
parent
7f9e7659b8
commit
d860453bae
@ -36,10 +36,13 @@ void free_rtos::EthUpdClient::put_data(uint32_t src_ip, uint8_t * p_data, uint32
|
||||
{
|
||||
LockGuard lock(rx_mut_); /// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (buff_.size() < max_buf_size) {
|
||||
buff_.insert(buff_.end(), p_data, p_data + len);
|
||||
if(buff_.size() + len > max_buf_size) {
|
||||
DebugP_log((char *)"Warning ! UDP client buffer overflow !\r\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
buff_.insert(buff_.end(), p_data, p_data + len);
|
||||
}
|
||||
|
||||
src_ip_ = src_ip;
|
||||
@ -76,7 +79,7 @@ int32_t free_rtos::EthUpdClient::read(uint8_t * p_data, uint32_t len)
|
||||
}
|
||||
|
||||
/// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
while (buff_.empty()) { // Не заменять на if ! Иначе следующий прием получит пустой буфер т.к. семафор может быть не сброшен !
|
||||
while (buff_.empty()) {
|
||||
rx_sem_.pend();
|
||||
}
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ public:
|
||||
int32_t read_async(uint8_t * p_data, uint32_t len);
|
||||
|
||||
template<class T, class Allocator>
|
||||
int32_t read_async(std::vector<T, Allocator>& data, uint32_t len = 65535)
|
||||
int32_t read_async(std::vector<T, Allocator>& data, uint32_t len)
|
||||
{
|
||||
if (len == 0) {
|
||||
return 0;
|
||||
@ -83,7 +83,7 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
const uint32_t max_buf_size = 0x100000; // 1Mb
|
||||
const uint32_t max_buf_size = 0x10000; // 0x10000 - 65536, 0x11CA - 4554, 0x0BDC - 3036, 0x100000 - 1Mb
|
||||
|
||||
Semaphore rx_sem_;
|
||||
Mutex rx_mut_;
|
||||
|
||||
@ -32,7 +32,13 @@ public:
|
||||
|
||||
virtual int32_t select(uint32_t ticks = SystemP_WAIT_FOREVER) override
|
||||
{
|
||||
return rx_sem_.pend(ticks);
|
||||
int32_t sts;
|
||||
|
||||
do {
|
||||
sts = rx_sem_.pend(ticks);
|
||||
} while(sts != SystemP_SUCCESS);
|
||||
|
||||
return sts;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user