clarify force

This commit is contained in:
Alex Dadgar 2018-02-09 10:30:32 -08:00
parent 317485e4f7
commit a9c4f8a4c8
1 changed files with 4 additions and 5 deletions

View File

@ -274,14 +274,13 @@ func (s *StreamFramer) Send(file, fileEvent string, data []byte, offset int64) e
s.data.Write(data)
// Handle the delete case in which there is no data
force := false
if s.data.Len() == 0 && s.f.FileEvent != "" {
force = true
}
force := s.data.Len() == 0 && s.f.FileEvent != ""
// Flush till we are under the max frame size
for s.data.Len() >= s.frameSize || force {
// Clear
// Clear since are flushing the frame and capturing the file event.
// Subsequent data frames will be flushed based on the data size alone
// since they share the same fileevent.
if force {
force = false
}