本文整理汇总了C#中Smb2FunctionalClient.LeaseBreakAcknowledgment方法的典型用法代码示例。如果您正苦于以下问题:C# Smb2FunctionalClient.LeaseBreakAcknowledgment方法的具体用法?C# Smb2FunctionalClient.LeaseBreakAcknowledgment怎么用?C# Smb2FunctionalClient.LeaseBreakAcknowledgment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smb2FunctionalClient
的用法示例。
在下文中一共展示了Smb2FunctionalClient.LeaseBreakAcknowledgment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AcknowledgeLeaseBreak
/// <summary>
/// Acknowledge LeaseBreakNotification received from server
/// </summary>
/// <param name="client">Client to send the acknowledgement</param>
/// <param name="treeId">TreeId associated to send the acknowledgement</param>
/// <param name="leaseBreakNotify">LeaseBreakNotification received from server</param>
protected virtual void AcknowledgeLeaseBreak(Smb2FunctionalClient client, uint treeId, LEASE_BREAK_Notification_Packet leaseBreakNotify)
{
if (receivedLeaseBreakNotify.Flags == LEASE_BREAK_Notification_Packet_Flags_Values.SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED)
{
BaseTestSite.Log.Add(
LogEntryKind.Debug,
"Server requires an LEASE_BREAK_ACK on this LEASE_BREAK_NOTIFY");
// Will add verification for response after SDK change
uint status = client.LeaseBreakAcknowledgment(treeId, leaseBreakNotify.LeaseKey, leaseBreakNotify.NewLeaseState);
BaseTestSite.Assert.AreEqual(
Smb2Status.STATUS_SUCCESS,
status,
"LeaseBreakAcknowledgement should succeed, actual status is {0}", Smb2Status.GetStatusCode(status));
}
else
{
BaseTestSite.Log.Add(
LogEntryKind.Debug,
"Server does not require an LEASE_BREAK_ACK on this LEASE_BREAK_NOTIFY");
}
}
示例2: DirecotryLeasing
//.........这里部分代码省略.........
if (expectedDialect == DialectRevision.Smb2002 || expectedDialect == DialectRevision.Smb21)
{
BaseTestSite.Assert.AreEqual(
OplockLevel_Values.OPLOCK_LEVEL_NONE,
response.OplockLevel,
"The expected oplock level is OPLOCK_LEVEL_NONE.");
}
});
#endregion
if (expectedDialect >= DialectRevision.Smb30)
{
// Break the lease with creating another file in the directory
sutProtocolController.CreateFile(Path.Combine(Smb2Utility.GetUncPath(TestConfig.SutComputerName, TestConfig.BasicFileShare), testDirectory), CurrentTestCaseName, string.Empty);
// Wait until LEASE_BREAK_Notification is received
BaseTestSite.Assert.IsTrue(
// Wait for notification arrival
notificationReceived.WaitOne(TestConfig.WaitTimeoutInMilliseconds),
"LeaseBreakNotification should be raised.");
if (receivedLeaseBreakNotify.Flags == LEASE_BREAK_Notification_Packet_Flags_Values.SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED)
{
BaseTestSite.Log.Add(
LogEntryKind.Debug,
"Server requires an LEASE_BREAK_ACK on this LEASE_BREAK_NOTIFY");
#region LEASE_BREAK_ACK
switch (leaseBreakAckType)
{
case LeaseBreakAckType.None:
status = client.LeaseBreakAcknowledgment(treeId, receivedLeaseBreakNotify.LeaseKey, receivedLeaseBreakNotify.NewLeaseState);
break;
case LeaseBreakAckType.InvalidLeaseState:
LeaseStateValues newLeaseState = LeaseStateValues.SMB2_LEASE_WRITE_CACHING;
BaseTestSite.Log.Add(
LogEntryKind.Comment,
"Client attempts to send LEASE_BREAK_ACK with an invalid LeaseState {0} on this LEASE_BREAK_NOTIFY", newLeaseState);
status = client.LeaseBreakAcknowledgment(
treeId,
receivedLeaseBreakNotify.LeaseKey,
newLeaseState,
checker: (header, response) =>
{
BaseTestSite.Assert.AreNotEqual(
Smb2Status.STATUS_SUCCESS,
header.Status,
"LEASE_BREAK_ACK with invalid LeaseState is not expected to SUCCESS, actually server returns {0}.", Smb2Status.GetStatusCode(header.Status));
BaseTestSite.CaptureRequirementIfAreEqual(
Smb2Status.STATUS_REQUEST_NOT_ACCEPTED,
header.Status,
RequirementCategory.STATUS_REQUEST_NOT_ACCEPTED.Id,
RequirementCategory.STATUS_REQUEST_NOT_ACCEPTED.Description);
});
break;
case LeaseBreakAckType.InvalidLeaseKey:
Guid invalidLeaseKey = Guid.NewGuid();
BaseTestSite.Log.Add(
LogEntryKind.Debug,
"Client attempts to send LEASE_BREAK_ACK with an invalid LeaseKey {0} on this LEASE_BREAK_NOTIFY", invalidLeaseKey);
status = client.LeaseBreakAcknowledgment(
treeId,