fix(contacts): use mux-wire wireReady before gossip broadcast
Prevents contacts presence and friend-request gossip from blocking on protomux fullyOpened() that never resolves on stale connections. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
const Protomux = require('protomux')
|
||||
const b4a = require('b4a')
|
||||
const { encodeRpc, decodeRpc } = require('pearcord-shared')
|
||||
const { openWireChannel } = require('pearcord-drive/mux-wire')
|
||||
const { openWireChannel, wireReady } = require('pearcord-drive/mux-wire')
|
||||
|
||||
const CONTACTS_PROTOCOL = 'pearcord-contacts-v1'
|
||||
|
||||
@@ -30,7 +30,7 @@ async function broadcastContactsGossip (contacts, method, payload) {
|
||||
await Promise.all(
|
||||
sessions.map(async (session) => {
|
||||
try {
|
||||
const ok = await session.fullyOpened().catch(() => false)
|
||||
const ok = await wireReady(session, 6000)
|
||||
if (!ok) return
|
||||
session.send(buf)
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user