Bounty
XE-13277 · Bounty

[net/msg.go] L6: Start() tidak cek duplikat stream handler — silent overwrite

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

Report

Ringkasan

Kalau Start dipanggil dua kali dengan protocol yang sama, stream handler yang lama ditimpa tanpa warning.

Lokasi

  • File: net/msg.go
  • Lines: 169-185

Kode

func (m *Messenger) Start(h host.Host, ng *NetworkGater, opts ...Option) {
    ...
    h.SetStreamHandler(m.protocol, func(s network.Stream) {
        ...
    })
    ...
}

Impact

Handler lama ditimpa. Kalau ada goroutine yang masih memproses handler lama, bisa terjadi race condition.

Suggested Fix

func (m *Messenger) Start(h host.Host, ng *NetworkGater, opts ...Option) {
    ...
    if m.started {
        logging.Warnf("msg: Start() called multiple times, skipping duplicate registration")
        return
    }
    m.started = true
    h.SetStreamHandler(m.protocol, func(s network.Stream) {
        ...
    })
    ...
}

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-13277 and says what; it is read like any other.