File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import (
1717 "fmt"
1818 "io"
1919 "math"
20+ "runtime/debug"
2021 "strconv"
2122 "time"
2223)
@@ -48,7 +49,9 @@ func (mc *mysqlConn) readPacket() ([]byte, error) {
4849
4950 // check packet sync [8 bit]
5051 if data [3 ] != mc .sequence {
51- // debug.PrintStack()
52+ if debugTrace {
53+ debug .PrintStack ()
54+ }
5255 mc .Close ()
5356 if data [3 ] > mc .sequence {
5457 return nil , ErrPktSyncMul
@@ -117,9 +120,11 @@ func (mc *mysqlConn) writePacket(data []byte) error {
117120 size = pktLen
118121 }
119122 data [3 ] = mc .sequence
120- // fmt.Fprintf(os.Stderr, "writePacket: seq=%v len=%v\n", mc.sequence, pktLen)
121123
122124 // Write packet
125+ if debugTrace {
126+ mc .cfg .Logger .Print (fmt .Sprintf ("writePacket: size=%v seq=%v" , size , mc .sequence ))
127+ }
123128 if mc .writeTimeout > 0 {
124129 if err := mc .netConn .SetWriteDeadline (time .Now ().Add (mc .writeTimeout )); err != nil {
125130 return err
@@ -426,7 +431,6 @@ func (mc *mysqlConn) writeCommandPacket(command byte) error {
426431 data , err := mc .buf .takeSmallBuffer (4 + 1 )
427432 if err != nil {
428433 // cannot take the buffer. Something must be wrong with the connection
429- // debug.PrintStack()
430434 mc .cfg .Logger .Print (err )
431435 return errBadConnNoWrite
432436 }
@@ -1219,7 +1223,7 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error {
12191223 }
12201224
12211225 err = mc .writePacket (data )
1222- mc .resetSeqNo ()
1226+ mc .syncSeqNo ()
12231227 return err
12241228}
12251229
You can’t perform that action at this time.
0 commit comments