mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-06 01:33:18 +02:00
Minor code refactoring
This commit is contained in:
parent
2698498c8b
commit
3f9daa39fe
2 changed files with 17 additions and 12 deletions
|
@ -71,5 +71,21 @@ namespace SMBLibrary.Server.SMB2
|
|||
response.Count = (uint)numberOfBytesWritten;
|
||||
return response;
|
||||
}
|
||||
|
||||
internal static SMB2Command GetFlushResponse(FlushRequest request, ISMBShare share, SMB2ConnectionState state)
|
||||
{
|
||||
SMB2Session session = state.GetSession(request.Header.SessionID);
|
||||
OpenFileObject openFile = session.GetOpenFileObject(request.FileId);
|
||||
if (openFile == null)
|
||||
{
|
||||
return new ErrorResponse(request.CommandName, NTStatus.STATUS_FILE_CLOSED);
|
||||
}
|
||||
NTStatus status = share.FileStore.FlushFileBuffers(openFile.Handle);
|
||||
if (status != NTStatus.STATUS_SUCCESS)
|
||||
{
|
||||
return new ErrorResponse(request.CommandName, status);
|
||||
}
|
||||
return new FlushResponse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,18 +165,7 @@ namespace SMBLibrary.Server
|
|||
}
|
||||
else if (command is FlushRequest)
|
||||
{
|
||||
FlushRequest request = (FlushRequest)command;
|
||||
OpenFileObject openFile = session.GetOpenFileObject(request.FileId);
|
||||
if (openFile == null)
|
||||
{
|
||||
return new ErrorResponse(request.CommandName, NTStatus.STATUS_FILE_CLOSED);
|
||||
}
|
||||
NTStatus status = share.FileStore.FlushFileBuffers(openFile.Handle);
|
||||
if (status != NTStatus.STATUS_SUCCESS)
|
||||
{
|
||||
return new ErrorResponse(request.CommandName, status);
|
||||
}
|
||||
return new FlushResponse();
|
||||
return ReadWriteResponseHelper.GetFlushResponse((FlushRequest)command, share, state);
|
||||
}
|
||||
else if (command is CloseRequest)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue