mirror of
https://github.com/amark/gun.git
synced 2025-06-08 15:16:42 +00:00
multicast fix
This commit is contained in:
parent
fe3a25682a
commit
ff9ff71cb2
@ -22,11 +22,10 @@ Gun.on('create', function(root){
|
|||||||
socket.bind({port: udp.port, exclusive: true}, function(){
|
socket.bind({port: udp.port, exclusive: true}, function(){
|
||||||
socket.setBroadcast(true);
|
socket.setBroadcast(true);
|
||||||
socket.setMulticastTTL(128);
|
socket.setMulticastTTL(128);
|
||||||
try{ socket.addMembership(udp.address); }catch(e){}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("listening", function(){
|
socket.on("listening", function(){
|
||||||
try { socket.addMembership(udp.address) }catch(e){ return }
|
try { socket.addMembership(udp.address) }catch(e){ console.error(e); return; }
|
||||||
udp.peer = {id: udp.address + ':' + udp.port, wire: socket};
|
udp.peer = {id: udp.address + ':' + udp.port, wire: socket};
|
||||||
|
|
||||||
udp.peer.say = function(raw){
|
udp.peer.say = function(raw){
|
||||||
@ -60,7 +59,7 @@ Gun.on('create', function(root){
|
|||||||
|
|
||||||
var url = 'http://' + info.address + ':' + (port || (opt.web && opt.web.address()||{}).port) + '/gun';
|
var url = 'http://' + info.address + ':' + (port || (opt.web && opt.web.address()||{}).port) + '/gun';
|
||||||
if(root.opt.peers[url]){ return }
|
if(root.opt.peers[url]){ return }
|
||||||
|
|
||||||
//console.log('discovered', url, message, info);
|
//console.log('discovered', url, message, info);
|
||||||
root.$.opt(url);
|
root.$.opt(url);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user