Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s_accept_reply problem #307

Open
Green7 opened this issue Apr 15, 2016 · 0 comments
Open

s_accept_reply problem #307

Green7 opened this issue Apr 15, 2016 · 0 comments

Comments

@Green7
Copy link

Green7 commented Apr 15, 2016

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:

  1. 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?)

  2. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant