You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have problem with zproto. Suppose we have the sample definition of the protocol :
<state name = "connected" inherit = "defaults">
<event name = "send request">
<action name = "send" message = "REQUEST" />
</event>
</state>
<!-- API methods -->
<method name = "send request" return = "status">
<field name = "params" type = "string" />
<accept reply = "SUCCESS" />
<accept reply = "FAILURE" />
</method>
Basically I have event "send request" connected with API function.
This event/api method is valid only in "connected" state.
But what happens if I call this API function in other state?
For example I want to call “send_request” method but before this server is down and now I'm in disconnected state.
In this case "send request" never come back!
Why? Because it sends event invalid in current state and wait for reply in
s_accept_reply function. Reply never come back ...
In s_accept_reply we have:
char *reply = zstr_recv (self->actor);
if (!reply)
break; // Interrupted or timed-out
and default timeout for actor is set to infinity.
Of course I can:
set timeout for actor socket. This is solution but not ideal (why do I have to wait 15 seconds for function return in situation that this is impossible to return with success?)
I can change protocol definition and handle "send request" event in all states. But is very hard to maintenance and not elegant solution...
I think that this situation should be handled better in code generator.
The text was updated successfully, but these errors were encountered:
I have problem with zproto. Suppose we have the sample definition of the protocol :
Basically I have event "send request" connected with API function.
This event/api method is valid only in "connected" state.
But what happens if I call this API function in other state?
For example I want to call “send_request” method but before this server is down and now I'm in disconnected state.
In this case "send request" never come back!
Why? Because it sends event invalid in current state and wait for reply in
s_accept_reply function. Reply never come back ...
In s_accept_reply we have:
and default timeout for actor is set to infinity.
Of course I can:
set timeout for actor socket. This is solution but not ideal (why do I have to wait 15 seconds for function return in situation that this is impossible to return with success?)
I can change protocol definition and handle "send request" event in all states. But is very hard to maintenance and not elegant solution...
I think that this situation should be handled better in code generator.
The text was updated successfully, but these errors were encountered: