3.1.4.9 Disconnecting from a RunspacePool

In order for the server session to support Disconnect and Connect operations, the client MUST provide a wsmv:SessionId element ([MS-WSMV] section 3.1.4.1.37) in all wxf messages. This element is the unique identifier of a client session and will remain the same for all messages sent from that session. Server sessions supporting Disconnect and Connect operations distinguish requests from different client sessions based on this identifier.

The higher layer can initiate the process of disconnecting from a RunspacePool. Any active pipelines will automatically be disconnected once the RunspacePool is disconnected. If the RunspacePool is not in the Opened state, the client ignores any requests to disconnect. Otherwise, the client takes the following actions to process the disconnect request:

  1. The client waits for any ongoing send operation to complete by waiting for wxf:SendResponse messages (see section 3.1.5.3.6) from the server.

  2. The client sends a wxf:Disconnect message (see section 3.1.5.3.16) using the ShellID specified in section 3.1.1.2.4.

  3. The client receives a wxf:DisconnectResponse (see section 3.2.5.3.17) from the server. The client changes the states of the RunspacePool (see section 3.1.1.2) and any associated pipelines to Disconnected. If the client receives a wxf:Fault message, it changes the RunspacePool state to Broken.