Client: Throw Exception if attemping to logoff when the client is not connected

This commit is contained in:
Tal Aloni 2017-09-23 13:30:26 +03:00
parent 2b3cee14a5
commit 6a03cfd952
2 changed files with 10 additions and 0 deletions

View file

@ -236,6 +236,11 @@ namespace SMBLibrary.Client
public NTStatus Logoff()
{
if (!m_isConnected)
{
throw new InvalidOperationException("A login session must be successfully established before attempting logoff");
}
LogoffAndXRequest request = new LogoffAndXRequest();
TrySendMessage(request);

View file

@ -162,6 +162,11 @@ namespace SMBLibrary.Client
public NTStatus Logoff()
{
if (!m_isConnected)
{
throw new InvalidOperationException("A login session must be successfully established before attempting logoff");
}
LogoffRequest request = new LogoffRequest();
TrySendCommand(request);