..
This commit is contained in:
parent
146ef6197d
commit
78465cfac8
1 changed files with 3 additions and 3 deletions
|
@ -8,7 +8,7 @@ void PokeData(struct RingBuffer* buffer, uint32_t number, uint8_t* data, size_t
|
||||||
number %= BUFFER_LENGTH;
|
number %= BUFFER_LENGTH;
|
||||||
|
|
||||||
buffer->delay += buffer->marks == 0; // Postpone processing if buffer empty
|
buffer->delay += buffer->marks == 0; // Postpone processing if buffer empty
|
||||||
buffer->marks |= 1 << number; // Set processing flag for the record
|
buffer->marks |= 1 << number; // Set processing mark for the record
|
||||||
|
|
||||||
struct BufferRecord* record = buffer->records + number;
|
struct BufferRecord* record = buffer->records + number;
|
||||||
|
|
||||||
|
@ -31,14 +31,14 @@ void ProcessBuffer(struct RingBuffer* buffer, int handle, struct sockaddr_in* ad
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t mark = (1 << buffer->index);
|
size_t mark = 1 << buffer->index;
|
||||||
|
|
||||||
if (buffer->marks & mark)
|
if (buffer->marks & mark)
|
||||||
{
|
{
|
||||||
// Transmit scheduled data
|
// Transmit scheduled data
|
||||||
struct BufferRecord* record = buffer->records + buffer->index;
|
struct BufferRecord* record = buffer->records + buffer->index;
|
||||||
sendto(handle, record->data, record->length, 0, (struct sockaddr*)address, sizeof(struct sockaddr_in));
|
sendto(handle, record->data, record->length, 0, (struct sockaddr*)address, sizeof(struct sockaddr_in));
|
||||||
// Clear processing flag
|
// Clear processing mark
|
||||||
buffer->marks ^= mark;
|
buffer->marks ^= mark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue