Skip to content

Commit

Permalink
BufFix: fix the problem that AsyncIO fails to correctly handle the re…
Browse files Browse the repository at this point in the history
…turn value when using SQ_POLL (#132)
  • Loading branch information
yanyupeng2018 authored May 27, 2024
1 parent 5c32e3f commit 00e845f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions trpc/runtime/iomodel/async_io/async_io.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ trpc::Future<int32_t> AsyncIO::SubmitOne(F&& fill_sqe) {
io_uring_sqe_set_data(sqe, user_data);

int ret = io_uring_submit(ring);
if (TRPC_UNLIKELY(ret != 1)) {
if (TRPC_UNLIKELY(ret <= 0)) {
trpc::object_pool::Delete<IOURingUserData>(user_data);
if (ret < 0) {
return MakeExceptionFuture<int32_t>(AsyncIOError(ret));
}
std::string msg = "Submit success but return not one, ret:" + std::to_string(ret);
return MakeExceptionFuture<int32_t>(AsyncIOError(AsyncIOError::SUBMIT_FAIL, msg));
}
submitted_++;
submitted_ += ret;

return user_data->pr.GetFuture();
}
Expand Down

0 comments on commit 00e845f

Please sign in to comment.