3.3.4.12 Server Application Requests Closing a Session
The calling application provides GlobalSessionId of the session to be closed. The server MUST look up Session from the GlobalSessionTable where Session.SessionGlobalId is equal to GlobalSessionId, and remove it from the table. If there is no matching session, the call MUST return.
The server MUST deregister the session by invoking the event specified in [MS-SRVS] section 3.1.6.3, providing GlobalSessionId as the input parameter. ServerStatistics.sts0_sopens MUST be decreased by 1.
The server MUST close every Open in Session.OpenTable as specified in 3.3.4.17.
The server MUST disconnect every TreeConnect in Session.TreeConnectTable and deregister TreeConnect by invoking the event specified in [MS-SRVS] section 3.1.6.7, providing the tuple <TreeConnect.Share.ServerName, TreeConnect.Share.Name> and TreeConnect.TreeGlobalId as the input parameters. For each deregistered TreeConnect, TreeConnect.Share.CurrentUses MUST be decreased by 1.
The session MUST be torn down and freed.