protected void Initalize(string connectionKey, GiopTransportMessageHandler transportHandler, GiopClientConnectionDesc assocDesc) { m_connectionKey = connectionKey; m_assocDesc = assocDesc; m_transportHandler = transportHandler; }
internal GiopClientConnectionDesc(GiopClientConnectionManager conManager, GiopClientConnection connection, GiopRequestNumberGenerator reqNumberGen, GiopTransportMessageHandler transportHandler) : base(conManager, transportHandler) { m_reqNumGen = reqNumberGen; m_connection = connection; }
internal AsynchronousResponseWaiter(GiopTransportMessageHandler transportHandler, uint requestId, AsyncResponseAvailableCallBack callback, IClientChannelSinkStack clientSinkStack, GiopClientConnection connection, MessageTimeout timeOut) { Initalize(transportHandler, requestId, callback, clientSinkStack, connection, timeOut); }
/// <param name="connectionKey">the key describing the connection</param> internal GiopBidirInitiatedConnection(string connectionKey, GiopTransportMessageHandler transportHandler, GiopClientConnectionManager conManager) { GiopRequestNumberGenerator reqNumberGen = new GiopRequestNumberGenerator(false); // not connection originator -> create non-even req. numbers GiopClientConnectionDesc conDesc = new GiopClientConnectionDesc(conManager, this, reqNumberGen, transportHandler); Initalize(connectionKey, transportHandler, conDesc); }
public void AsyncProcessResponse(IServerResponseChannelSinkStack sinkStack, object state, IMessage msg, ITransportHeaders headers, Stream stream) { #if DEBUG Debug.WriteLine("Send response async"); OutputHelper.LogStream(stream); #endif GiopTransportMessageHandler giopTransportMsgHandler = ((GiopServerConnection)state).TransportHandler; giopTransportMsgHandler.SendResponse(stream); // send the response }
/// <param name="connectionKey">the key describing the connection</param> /// <param name="transport">a not yet connected client transport</param> /// <param name="headerFlags">the header flags to use for transport related giop messages.</param> internal GiopClientInitiatedConnection(string connectionKey, IClientTransport transport, MessageTimeout requestTimeOut, GiopClientConnectionManager conManager, bool supportBidir, byte headerFlags) { GiopRequestNumberGenerator reqNumberGen = (!supportBidir ? new GiopRequestNumberGenerator() : new GiopRequestNumberGenerator(true)); GiopTransportMessageHandler handler = new GiopTransportMessageHandler(transport, requestTimeOut, headerFlags); GiopClientConnectionDesc conDesc = new GiopClientConnectionDesc(conManager, this, reqNumberGen, handler); m_clientTransport = transport; Initalize(connectionKey, handler, conDesc); }
private void Initalize(GiopTransportMessageHandler transportHandler, uint requestId, AsyncResponseAvailableCallBack callback, IClientChannelSinkStack clientSinkStack, GiopClientConnection connection, MessageTimeout timeOutMillis) { m_alreadyNotified = false; m_transportHandler = transportHandler; m_requestId = requestId; m_callback = callback; m_clientConnection = connection; m_clientSinkStack = clientSinkStack; m_timeOut = timeOutMillis; }
/// <summary>creates a giop transport message handler, which accept request messages by delegating to receiver</summary> /// <param name="serverThreadsMaxPerConnection"> /// the maximum number of server threads used for processing requests on a multiplexed client connection. /// </param> internal GiopReceivedRequestMessageDispatcher(IGiopRequestMessageReceiver receiver, GiopTransportMessageHandler msgHandler, GiopConnectionDesc conDesc, int serverThreadsMaxPerConnection) { m_serverCon = new GiopServerConnection(conDesc, this); if (receiver != null) { m_receiver = receiver; } else { throw new BAD_PARAM(400, CompletionStatus.Completed_MayBe); } m_msgHandler = msgHandler; if (serverThreadsMaxPerConnection < 1) { throw new BAD_PARAM(401, CompletionStatus.Completed_MayBe); } m_maxRequestsAllowedInParallel = serverThreadsMaxPerConnection; }
public void ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, out ITransportHeaders responseHeaders, out Stream responseStream) { #if DEBUG OutputHelper.LogStream(requestStream); #endif // called by the chain, chain expect response-stream and headers back GiopClientConnection clientCon = GetClientConnection(msg); GiopTransportMessageHandler handler = clientCon.TransportHandler; // send request and wait for response responseHeaders = new TransportHeaders(); responseHeaders[GiopClientConnectionDesc.CLIENT_TR_HEADER_KEY] = clientCon.Desc; // add to response headers uint reqNr = (uint)msg.Properties[SimpleGiopMsg.REQUEST_ID_KEY]; responseStream = handler.SendRequestSynchronous(requestStream, reqNr, clientCon); #if DEBUG OutputHelper.LogStream(responseStream); #endif responseStream.Seek(0, SeekOrigin.Begin); // assure stream is read from beginning in formatter // the previous sink in the chain does further process this response ... }
/// <summary>configures a client initiated connection to receive callbacks.</summary> /// <remarks>for use case (2)</remarks> internal void SetupConnectionForBidirReception(GiopClientConnectionDesc conDesc) { if (m_receptionHandler != null) { if (conDesc.Connection is GiopClientInitiatedConnection) { GiopTransportMessageHandler handler = conDesc.Connection.TransportHandler; handler.InstallReceiver(m_receptionHandler, conDesc, m_serverThreadsMaxPerConnection); // set, if not yet set. } else { throw new INTERNAL(545, CompletionStatus.Completed_MayBe); } } else { throw new INTERNAL(544, CompletionStatus.Completed_MayBe); } }
public void AsyncProcessRequest(IClientChannelSinkStack sinkStack, IMessage msg, ITransportHeaders headers, Stream requestStream) { #if DEBUG OutputHelper.LogStream(requestStream); #endif // this is the last sink in the chain, therefore the call is not forwarded, instead the request is sent GiopClientConnection clientCon = GetClientConnection(msg); GiopTransportMessageHandler handler = clientCon.TransportHandler; uint reqNr = (uint)msg.Properties[SimpleGiopMsg.REQUEST_ID_KEY]; if (!GiopMessageHandler.IsOneWayCall((IMethodCallMessage)msg)) { handler.SendRequestMessageAsync(requestStream, reqNr, new AsyncResponseAvailableCallBack(this.AsyncResponseArrived), sinkStack, clientCon); } else { handler.SendRequestMessageOneWay(requestStream, reqNr, clientCon); } }
/// <summary> /// this method handles the incoming messages from one client; /// it's called by the IServerListener /// </summary> private void ProcessClientMessages(IServerTransport transport) { GiopTransportMessageHandler handler = new GiopTransportMessageHandler(transport, m_headerFlags); GiopConnectionDesc conDesc = new GiopConnectionDesc(m_bidirConnectionManager, handler); handler.InstallReceiver(m_transportSink, conDesc, m_serverThreadsMaxPerConnection); handler.ConnectionClosed += new GiopTransportMessageHandler.ConnectionClosedDelegate(EndClientMessages); lock (m_activeClients.SyncRoot) { m_activeClients.Add(handler); Debug.WriteLine("added client; peer addr: " + handler.Transport.GetPeerAddress()); Debug.WriteLine("added client; new number of active: " + m_activeClients.Count); } handler.StartMessageReception(); }
/// <summary> /// informs the channel, that the message handling for a specific client has ended. /// </summary> private void EndClientMessages(GiopTransportMessageHandler sender, EventArgs args) { // the client is represented by the GiopTransportMessageHandler lock (m_activeClients.SyncRoot) { m_activeClients.Remove(sender); // remove from active clients. Debug.WriteLine("removed client; new number of active: " + m_activeClients.Count); } }
public SynchronousResponseWaiter(GiopTransportMessageHandler handler) { m_waiter = new ManualResetEvent(false); m_handler = handler; }
public MessageSendTask(ITransport onTransport, GiopTransportMessageHandler messageHandler) { Initalize(onTransport, messageHandler); }
public MessageReceiveTask(ITransport onTransport, GiopTransportMessageHandler messageHandler) { m_onTransport = onTransport; m_messageHandler = messageHandler; }
private void Initalize(ITransport onTransport, GiopTransportMessageHandler messageHandler) { m_onTransport = onTransport; m_messageHandler = messageHandler; }
internal GiopConnectionDesc(GiopClientConnectionManager conManager, GiopTransportMessageHandler transportHandler) { m_conManager = conManager; m_transportHandler = transportHandler; }