THRIFT-5128 Swift TFramedTransport does not work using present code
Client: Swift
Patch: Jano Svitok
This closes #2047
diff --git a/lib/swift/Sources/TFramedTransport.swift b/lib/swift/Sources/TFramedTransport.swift
index 59855eb..9f75b5e 100644
--- a/lib/swift/Sources/TFramedTransport.swift
+++ b/lib/swift/Sources/TFramedTransport.swift
@@ -65,7 +65,9 @@
throw TTransportError(error: .sizeLimit(limit: maxSize, got: toRead))
}
- return try transport.readAll(size: toRead)
+ let data = try transport.readAll(size: toRead)
+ remainingBytes -= data.count
+ return data
}
public func flush() throws {
@@ -73,10 +75,6 @@
let buff = writeBuffer
writeBuffer = Data()
- if buff.count - TFramedTransport.headerSize < 0 {
- throw TTransportError(error: .unknown)
- }
-
let frameSize = encodeFrameSize(size: UInt32(buff.count))
try transport.write(data: frameSize)