Skip to content
This repository was archived by the owner on Apr 24, 2020. It is now read-only.
This repository was archived by the owner on Apr 24, 2020. It is now read-only.

Send from a request endpoint can trigger receive callbacks #560

@jez9999

Description

@jez9999

Following on from a question I filed on StackOverflow:
http://stackoverflow.com/questions/39573399/why-are-my-request-and-response-messages-out-of-order

... from my reading of the code, a call to zmq.socket("req").send(...) can lead to a "message" callback being executed. In binding.cc, this seems to be because Socket::Sendv can call socket->NotifyReadReady().

Why does the code work this way? It seems to me to break the expected flow of Node.js, which is that events will only be triggered once the event loop finishes executing the current code. The way this is designed, the execution of the current code suddenly jumps to triggering callbacks and then returns to executing the current code. Why can't it just wait until the event loop is ready to check for responses? This behaviour should at least be separated out into a new send_and_check function or something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions