relay: fix unsafe overwriting of event buffer that affected parsed pubkeys, ids, content.

This commit is contained in:
fiatjaf
2025-04-07 15:56:36 -03:00
parent 0fc00d8a68
commit dad99b226c

View File

@@ -13,7 +13,6 @@ import (
"sync"
"sync/atomic"
"time"
"unsafe"
"github.com/puzpuzpuz/xsync/v3"
)
@@ -224,8 +223,7 @@ func (r *Relay) ConnectWithTLS(ctx context.Context, tlsConfig *tls.Config) error
break
}
msgb := buf.Bytes()
message := unsafe.String(unsafe.SliceData(msgb), len(msgb))
message := string(buf.Bytes())
debugLogf("{%s} received %v\n", r.URL, message)
// if this is an "EVENT" we will have this preparser logic that should speed things up a little