Skip to content

Commit d0d1f52

Browse files
glbrnttpinlin168
authored andcommitted
Avoid a CoW in the client read state (grpc#1533)
Motivation: In some Swift versions the reader is CoW'd when appending in one of the client state machines substates. Modifications: - Temporarily switch state before appending to the reader Result: Fewer CoWs
1 parent f3d71bd commit d0d1f52

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Sources/GRPC/ReadWriteStates.swift

+1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ enum ReadState {
150150
return .failure(.cardinalityViolation)
151151

152152
case .reading(let readArity, var reader):
153+
self = .notReading // Avoid CoWs
153154
reader.append(buffer: &buffer)
154155
var messages: [ByteBuffer] = []
155156

0 commit comments

Comments
 (0)