writeRecord writes a TLS record with the given type and payload to the connection and updates the record layer state. ONLY used by REALITY
(typ recordType, data []byte)
| 1116 | // connection and updates the record layer state. |
| 1117 | // ONLY used by REALITY |
| 1118 | func (c *Conn) writeRecord(typ recordType, data []byte) (int, error) { |
| 1119 | c.out.Lock() |
| 1120 | defer c.out.Unlock() |
| 1121 | |
| 1122 | if typ == recordTypeHandshake && c.out.handshakeBuf != nil && |
| 1123 | len(data) > 0 && data[0] != typeServerHello { |
| 1124 | c.out.handshakeBuf = append(c.out.handshakeBuf, data...) |
| 1125 | if data[0] != typeFinished { |
| 1126 | return len(data), nil |
| 1127 | } |
| 1128 | data = c.out.handshakeBuf |
| 1129 | c.out.handshakeBuf = nil |
| 1130 | } |
| 1131 | |
| 1132 | return c.writeRecordLocked(typ, data) |
| 1133 | } |
| 1134 | |
| 1135 | // writeChangeCipherRecord writes a ChangeCipherSpec message to the connection and |
| 1136 | // updates the record layer state. |
no test coverage detected