Explorar o código

Avoid a CoW in the client read state (#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
George Barnett %!s(int64=3) %!d(string=hai) anos
pai
achega
d4a58a3181
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      Sources/GRPC/ReadWriteStates.swift

+ 1 - 0
Sources/GRPC/ReadWriteStates.swift

@@ -150,6 +150,7 @@ enum ReadState {
       return .failure(.cardinalityViolation)
 
     case .reading(let readArity, var reader):
+      self = .notReading // Avoid CoWs
       reader.append(buffer: &buffer)
       var messages: [ByteBuffer] = []