Skip to content

Commit 2269029

Browse files
committed
replication: Improve COM_REGISTER_SLAVE
1 parent dc262fe commit 2269029

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

replication/binlogsyncer.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ func (b *BinlogSyncer) writeRegisterSlaveCommand() error {
596596
hostname := b.localHostname()
597597

598598
// This should be the name of slave host not the host we are connecting to.
599-
data := make([]byte, 4+1+4+1+len(hostname)+1+len(b.cfg.User)+1+len(b.cfg.Password)+2+4+4)
599+
data := make([]byte, 4+1+4+1+len(hostname)+1+len(b.cfg.User)+1+1+2+4+4)
600600
pos := 4
601601

602602
data[pos] = COM_REGISTER_SLAVE
@@ -616,10 +616,8 @@ func (b *BinlogSyncer) writeRegisterSlaveCommand() error {
616616
n = copy(data[pos:], b.cfg.User)
617617
pos += n
618618

619-
data[pos] = uint8(len(b.cfg.Password))
619+
data[pos] = uint8(0)
620620
pos++
621-
n = copy(data[pos:], b.cfg.Password)
622-
pos += n
623621

624622
binary.LittleEndian.PutUint16(data[pos:], b.cfg.Port)
625623
pos += 2

0 commit comments

Comments
 (0)