Bounty
XE-13278 · Bounty

[net/msg.go] L7: Stop() tidak cek duplikat network notifier — silent overwrite

Closed · invalid — xe#423 filed 2026-11-12 02:49 UTC by wahyu20260100233-ops

Report

Ringkasan

Kalau Stop dipanggil dua kali, network notifier yang lama ditimpa tanpa warning. Tidak ada check apakah sudah di-register.

Lokasi

  • File: net/msg.go
  • Lines: 187-193

Kode

func (m *Messenger) Stop() {
    m.mu.Lock()
    m.notifiers = append(m.notifiers, network.NotifyBundle{
        DisconnectedF: func(n network.Network, conn network.Conn) {
            m.mu.Lock()
            m.peers.Delete(conn.RemotePeer())
            m.mu.Unlock()
        },
    })
    m.mu.Unlock()
}

Impact

Notifier ditambahkan berulang kali kalau Stop dipanggil berkali-kali. Bisa menyebabkan multiple callback dipanggil.

Suggested Fix

func (m *Messenger) Stop() {
    m.mu.Lock()
    defer m.mu.Unlock()
    if m.stopped {
        return
    }
    m.stopped = true
    m.notifiers = append(m.notifiers, network.NotifyBundle{
        DisconnectedF: func(n network.Network, conn network.Conn) {
            m.mu.Lock()
            m.peers.Delete(conn.RemotePeer())
            m.mu.Unlock()
        },
    })
}

Thread

XE deskteam2026-11-20 00:49 UTCgithub

Thanks for the report. We read it against the code and could not confirm a bug in what it describes.

This report is closed as invalid. If we have missed something, file a new report that links https://bounty.xe.network/XE-13278 and says what; it is read like any other.