forked from snxraven/LinkUp-P2P-Chat
Trying to fix peer counts
This commit is contained in:
parent
8c54e4ca77
commit
ac2da1524d
2
app.js
2
app.js
@ -67,6 +67,7 @@ async function initialize() {
|
|||||||
swarm.on('connection', async (connection, info) => {
|
swarm.on('connection', async (connection, info) => {
|
||||||
peerCount++;
|
peerCount++;
|
||||||
updatePeerCount();
|
updatePeerCount();
|
||||||
|
console.log('Peer connected, current peer count:', peerCount);
|
||||||
|
|
||||||
// Send the current user's icon to the new peer
|
// Send the current user's icon to the new peer
|
||||||
const iconBuffer = await drive.get(`/icons/${userName}.png`);
|
const iconBuffer = await drive.get(`/icons/${userName}.png`);
|
||||||
@ -94,6 +95,7 @@ async function initialize() {
|
|||||||
connection.on('close', () => {
|
connection.on('close', () => {
|
||||||
peerCount--;
|
peerCount--;
|
||||||
updatePeerCount();
|
updatePeerCount();
|
||||||
|
console.log('Peer disconnected, current peer count:', peerCount);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user