Fix bug with empty consumer buffers which mostly affected Linux
This commit is contained in:
parent
399ec66bda
commit
b7da8fc7d8
|
@ -44,6 +44,7 @@ public struct GzipServerMiddleware: Middleware, ServiceType {
|
||||||
return data.subdata(in: offset..<offset+readSize)
|
return data.subdata(in: offset..<offset+readSize)
|
||||||
},
|
},
|
||||||
consumer: { data -> Void in
|
consumer: { data -> Void in
|
||||||
|
guard data.count > 0 else { return } // Skip empty buffers
|
||||||
var buffer = ByteBufferAllocator().buffer(capacity: bufSize)
|
var buffer = ByteBufferAllocator().buffer(capacity: bufSize)
|
||||||
buffer.write(bytes: data)
|
buffer.write(bytes: data)
|
||||||
write = write.flatMap {
|
write = write.flatMap {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user