mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-06 16:56:45 +08:00
clean msg-storage quickly
This commit is contained in:
parent
ce3e9869fb
commit
6f5c594dcf
@ -285,18 +285,18 @@ static bool send(F&& gen_push, ipc::handle_t h, void const * data, std::size_t s
|
|||||||
for (int i = 0; i < static_cast<int>(size / data_length); ++i, offset += data_length) {
|
for (int i = 0; i < static_cast<int>(size / data_length); ++i, offset += data_length) {
|
||||||
if (!try_push(static_cast<int>(size) - offset - static_cast<int>(data_length),
|
if (!try_push(static_cast<int>(size) - offset - static_cast<int>(data_length),
|
||||||
static_cast<byte_t const *>(data) + offset, data_length)) {
|
static_cast<byte_t const *>(data) + offset, data_length)) {
|
||||||
info_of(h)->clear_store();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
info_of(h)->clear_store();
|
||||||
}
|
}
|
||||||
// if remain > 0, this is the last message fragment
|
// if remain > 0, this is the last message fragment
|
||||||
int remain = static_cast<int>(size) - offset;
|
int remain = static_cast<int>(size) - offset;
|
||||||
if (remain > 0) {
|
if (remain > 0) {
|
||||||
if (!try_push(remain - static_cast<int>(data_length),
|
if (!try_push(remain - static_cast<int>(data_length),
|
||||||
static_cast<byte_t const *>(data) + offset, static_cast<std::size_t>(remain))) {
|
static_cast<byte_t const *>(data) + offset, static_cast<std::size_t>(remain))) {
|
||||||
info_of(h)->clear_store();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
info_of(h)->clear_store();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user