Sorry - it is hard to tell what is wrong.
As a side effect (calling a const function) changes the behavior, you
should search of some other generic problem (race-conditions,
wrong/incompatible libraries, dangling pointers, whatever in C++ can go
wrong).
On Wednesday, May 10, 2023 at 5:59:36 PM UTC+2 Matteo Stefanini wrote:
>
> > The generated method "counter()" should be const (at least with new
> protoc compilers), therefor it cannot have any impact if you call it or not.
>
> You are right, this is the implementation of the autogenerated code:
>
> inline ::uint32_t Response::counter() const {
> // @@protoc_insertion_point(field_get:Response.counter)
> return _internal_counter();
> }
>
> Where can I check where the problem is?
>
> I don't have a clue due to the very small part of the code being pretty
> straightforward
>
> On Wednesday, 10 May 2023 at 17:05:28 UTC+2 Tobias Krueger wrote:
>
>> > Am I doing something wrong?
>>
>> IMHO there must be something different.
>>
>> The generated method "counter()" should be const (at least with new
>> protoc compilers), therefor it cannot have any impact if you call it or not.
>>
>>
>> On Wednesday, May 10, 2023 at 4:58:33 PM UTC+2 Matteo Stefanini wrote:
>>
>>> Hi everyone,
>>>
>>> I'm trying to send an integer back to the client but no data are sent.
>>> The only solution found is to call 'response->counter()' before sending
>>> it
>>>
>>> message Response
>>> {
>>> string message = 1;
>>> uint32 time_ms = 2;
>>> bool is_over = 3;
>>> uint32 counter = 4;
>>> }
>>>
>>>
>>> Status Step(ServerContext* context, const service::Request* request,
>>> service::Response* response) override
>>> {
>>> response->set_message( "step_success" );
>>> response->set_is_over( true );
>>> response->set_counter( 10 );
>>> response->counter();
>>>
>>> return Status::OK;
>>> }
>>>
>>> Am I doing something wrong?
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/b4ededf4-9bdf-4393-923b-bf0471165f7fn%40googlegroups.com.