@@ -87,11 +87,11 @@ type Conn struct {
87
87
// input/output
88
88
in , out halfConn
89
89
rawInput MsgBuffer // raw input, starting with a record header
90
- input * MsgBuffer // 指针指向gnet.conn的inboundBuffer
90
+ input * * MsgBuffer // 指针指向gnet.conn的inboundBuffer
91
91
hand MsgBuffer // handshake data waiting to be read
92
92
outBuf []byte // scratch buffer used by out.encrypt
93
93
buffering bool // whether records are buffered in sendBuf
94
- sendBuf * MsgBuffer // a buffer of records waiting to be sent
94
+ sendBuf * * MsgBuffer // a buffer of records waiting to be sent
95
95
96
96
// bytesSent counts the bytes of application data sent.
97
97
// packetsSent counts packets.
@@ -535,7 +535,7 @@ func (c *Conn) readRecord() error {
535
535
}
536
536
537
537
func (c * Conn ) readChangeCipherSpec () error {
538
- c .input .Reset ()
538
+ ( * c .input ) .Reset ()
539
539
return c .readRecordOrCCS (true )
540
540
}
541
541
@@ -680,7 +680,7 @@ func (c *Conn) readRecordOrCCS(expectChangeCipherSpec bool) error {
680
680
// Note that data is owned by c.rawInput, following the Next call above,
681
681
// to avoid copying the plaintext. This is safe because c.rawInput is
682
682
// not read from or written to until c.input is drained.
683
- c .input .Write (data )
683
+ ( * c .input ) .Write (data )
684
684
685
685
case recordTypeHandshake :
686
686
if len (data ) == 0 || expectChangeCipherSpec {
@@ -700,7 +700,7 @@ func (c *Conn) retryReadRecord(expectChangeCipherSpec bool) error {
700
700
c .sendAlert (alertUnexpectedMessage )
701
701
return c .in .setErrorLocked (errors .New ("tls: too many ignored records" ))
702
702
}
703
- c .input .Reset ()
703
+ ( * c .input ) .Reset ()
704
704
if c .rawInput .Len () > 5 {
705
705
return c .readRecordOrCCS (expectChangeCipherSpec )
706
706
}
@@ -812,13 +812,13 @@ func (c *Conn) maxPayloadSizeForWrite(typ recordType) int {
812
812
func (c * Conn ) write (data []byte ) (n int , err error ) {
813
813
//必须把所有数据往buf写
814
814
n = len (data )
815
- c .sendBuf .Write (data )
815
+ ( * c .sendBuf ) .Write (data )
816
816
c .bytesSent += int64 (n )
817
817
return
818
818
}
819
819
820
820
func (c * Conn ) flush () (int , error ) {
821
- if c .sendBuf .Len () == 0 {
821
+ if ( * c .sendBuf ) .Len () == 0 {
822
822
return 0 , nil
823
823
}
824
824
n , err := c .conn .Write (nil )
0 commit comments