Package empro :: Module empro :: Module core :: Class EmSubprocessRpc
[frames] | no frames]

Class EmSubprocessRpc

Known Subclasses:

RPC interface between a parent and a child process (used by both sides). Simple XML based RPC protocol: Uses <call> for calls, <reply> for replies and <error> for errors. All other encoding is up to the user. It is supported to call the peer while being called yourself.

Class Hierarchy for EmSubprocessRpc
Class Hierarchy for EmSubprocessRpc

Instance Methods
string
call(arguments)
RPC client functionality.
string
reply(arguments)
RPC server functionality.
bool
startDialog(autoStopInEventLoop)
No-op if EmSubprocessIpc::status() is ConnectedPeerWaitsListening (will return true in that case).
None
stopDialog()
Always unregisters any outstanding autoStopInEventLoop event.
None
waitForCallAndReply()
Uses EmSubprocessIpc::waitUntilSpokenTo to block until we get an RPC request, and handles it.
Properties
boolNone inReply
Returns whether we are currently replying to a call.
Method Details

call(arguments)

 

RPC client functionality. Error messages are never returned, but raised as an Exception. If EmSubprocessIpc::status() is Connecting or Connected, startDialog() is invoked to get to ConnectedPeerWaitsListening (and throws on failure).

Parameters:
  • arguments (string) - The XML <call>.
Returns: string

reply(arguments)

 

RPC server functionality. Exceptions are caught and become error messages.

Parameters:
  • arguments (string) - The XML <call>.
Returns: string

startDialog(autoStopInEventLoop)

 

No-op if EmSubprocessIpc::status() is ConnectedPeerWaitsListening (will return true in that case). Otherwise, will invoke EmSubprocessIpc::askToSpeak to get to ConnectedPeerWaitsListening. Returns the result of EmSubprocessIpc::askToSpeak (always true for the parent process). If askToSpeak returned true and autoStopInEventLoop has been set, also registers an event (using the deleteLater mechanism) to stop the dialog once the calling function returns control to a surrounding event loop.

Parameters:
  • autoStopInEventLoop (bool) - Whether to stop the dialog once the calling function returns control to a surrounding event loop.
Returns: bool

stopDialog()

 

Always unregisters any outstanding autoStopInEventLoop event. Furthermore, no-op unless EmSubprocessIpc::status() is ConnectedPeerWaitsListening and we are not currently replying to a call. Stops the dialog with the peer and lets it resume execution. Will throw when EmSubprocessIpc::speak throws.

Returns: None