共用方式為


3.3.4.8 Server Application Requests Closing a Session

The calling application MUST provide the GlobalSessionId of the session to be closed. The server MUST enumerate all Connections in Server.ConnectionTable and MUST look up Session from the Connection.SessionTable where Session.SessionGlobalId is equal to GlobalSessionId. The server MUST remove Session from the Connection.SessionTable, MUST decrease Server.Statistics.sts0_sopens by 1, and MUST release every lock in Server.Open.Locks. If there is no matching session, the call MUST return.

The server MUST deregister the session by invoking the event Server Deregisters a Session ([MS-SRVS] section 3.1.6.3), providing GlobalSessionId as the input parameter.

The server MUST close every Open in the Session.Connection.FileOpenTable as specified in section 3.3.4.13 where Open.Session matches Session.

For each TreeConnect in Session.Connection.TreeConnectTable where TreeConnect.Session matches Session, the server MUST perform the following:

  • Deregister the Treeconnect ([MS-SRVS] section 3.1.6.7), providing the tuple <TreeConnect.Share.ServerName, TreeConnect.Share.Name> and TreeConnect.TreeGlobalId as the input parameters.

  • Decrement TreeConnect.Share.CurrentUses by 1.

  • Disconnect and remove the TreeConnect from Session.Connection.TreeConnectTable.

The session MUST be torn down and freed.