Skip to content

Commit

Permalink
replication: Improve COM_REGISTER_SLAVE
Browse files Browse the repository at this point in the history
  • Loading branch information
dveeden committed Jan 10, 2025
1 parent dc262fe commit 2269029
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions replication/binlogsyncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ func (b *BinlogSyncer) writeRegisterSlaveCommand() error {
hostname := b.localHostname()

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

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

data[pos] = uint8(len(b.cfg.Password))
data[pos] = uint8(0)
pos++
n = copy(data[pos:], b.cfg.Password)
pos += n

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

0 comments on commit 2269029

Please sign in to comment.