Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general I am fine with sending this field,
But I am wondering whether this should be the default behavior in the (very generic and reusable)
HttpUtils.h
module.My suggestion would be to go to Server::process (in Server.cpp, this is the actual QLever server),
and take the
send
parameter (an awaitable that takes the message and sets it),and modify it by setting the response there.
(And then always use
sendActual
instead ofsend
(or rather rename the parameter send).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also it's worth noting that #513 introduced an overload of this function that would need similar code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks + very true + I fixed it!
As an aside: I was and am confused about the use of co_return in this code. It seems to be used (or not) in an inconsistent fashion OR I have not fully understood when it must be used and when not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, our Server
awaitables
all co_returnvoid
. As in "ordinary" void functions, you do not need this statementif your function naturally "falls off the cliff" at the closing
}
.Additionally,
co_await
of anawaitable<void>
also is a void statement, so consider the analogy between these examples:Similarly, in coroutine land
Only exception: Every coroutine needs at least one
co_await, co_return
orco_yield
statement,so the following co_return is needed: