internal void CancelRequest( Request req ) { m_requests.Remove( req ); req.Signal( ); }
private IncomingMessage[ ] SyncMessages( OutgoingMessage[ ] messages, int retries, int timeout ) { int cMessage = messages.Length; IncomingMessage[ ] replies = new IncomingMessage[ cMessage ]; Request[ ] requests = new Request[ cMessage ]; for( int iMessage = 0; iMessage < cMessage; iMessage++ ) { replies[ iMessage ] = SyncRequest( messages[ iMessage ], retries, timeout ); } return replies; }
internal Request AsyncRequest( OutgoingMessage msg, int retries, int timeout ) { Request req = new Request( this, msg, retries, timeout, null ); lock( m_state.SyncObject ) { //Checking whether IsRunning and adding the request to m_requests //needs to be atomic to avoid adding a request after the Engine //has been stopped. if( !IsRunning ) { throw new ApplicationException( "Engine is not running or process has exited." ); } m_requests.Add( req ); req.SendAsync( ); } return req; }