3.1.4.2 Create Connection

When the higher-layer protocol requests a new connection, it MUST specify the following arguments:

  • The Name Object of the partner with which to create the connection.

  • The Outgoing Connection Type of the connection to create.

  • The Incoming Message Notification Interface.

First, the MSDTC Connection Manager: OleTx Multiplexing Protocol (CMP) instance MUST look up the Session object with the specified Name Object in the Session Table. If a matching session does not exist, the CMP instance MUST request a new session with the partner from the underlying transports instance as specified in [MS-CMPO]. If the request is unsuccessful, then the connection request MUST fail. The CMP instance MUST initialize its extensions to the Session object as follows:

  • The Incoming Connection Table MUST be empty.

  • The Outgoing Connection Table MUST be empty.

  • The Count of Allocated Outgoing Connections MUST be zero.

  •  The Count of Allocated Incoming Connections MUST be zero.

  •  The Boxcar Queue MUST be empty.

After a Session object has been found or created, the CMP instance MUST compare the number of Connection objects in the Outgoing Connection Table in the Session object with the Count of Allocated Outgoing Connections. If they are equal, then the CMP instance MUST request resource allocation from the underlying transports protocol instance, as specified in [MS-CMPO] section 3.4.6.4. The CMP instance MUST provide the Session object. In addition, it MUST specify the RT_CONNECTIONS value for the RESOURCE_TYPE enumeration as specified in [MS-CMPO] section 2.2.7, and it MUST specify a number of resources equal to or greater than 1.

If the request is successful, then the number of resources that were actually allocated MUST be added to the Count of Allocated Outgoing Connections. Otherwise, the connection request MUST fail and the Session object MUST be left unmodified, with the exception that if both the Incoming and Outgoing Connection Tables are empty, then the Idle Timer (section 3.1.6.1) associated with the Session object MUST be started.

Note If this is a newly created Session object and the Idle Timer is already running (due to both Incoming and Outgoing Connection Tables being initialized as empty) and the connection resource allocation has failed, then the Idle Timer is restarted at this point.

Next, the CMP instance MUST allocate a new Connection object with the specified connection type and with a connection identifier that is currently unused in the Outgoing Connection Table. The Accepted field of the new Connection object MUST be set to true. This Connection object MUST be added to the Outgoing Connection Table. If the Idle Timer is active, the timer MUST be canceled. The Incoming Message Notification Interface that was provided by the higher-layer protocol MUST be stored in the Incoming Message Notification ADM element.

Finally, the CMP instance MUST allocate an MTAG_CONNECTION_REQ message. It MUST set the dwUserMsgType field in the MsgHeader field to the specified connection type, and it MUST set the dwConnectionId field in the MsgHeader field to the connection identifier of the new Connection object. It MUST enqueue the message on the Session object as described in section 3.1.7.1.