Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stun:global.stun.twilio.com:3478 #56

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions dist/p2pt.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -9147,7 +9147,7 @@ Peer.config = {
urls: 'stun:stun.l.google.com:19302'
},
{
urls: 'stun:global.stun.twilio.com:3478?transport=udp'
urls: 'stun:global.stun.twilio.com:3478'
}
],
sdpSemantics: 'unified-plan'
Expand Down Expand Up @@ -10135,9 +10135,17 @@ class P2PT extends EventEmitter {

data.msg = remaining
chunks++
if((chunks % 100) == 0){
await sleep(500);
}
}

setTimeout(()=>{
resolve(null);
},60000);
debug('sent a message to ' + peer.id)
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
})
}

Expand Down
2 changes: 1 addition & 1 deletion dist/p2pt.umd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion node.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const BrowserP2PT = require('./p2pt')
const wrtc = require('wrtc')
const wrtc = require('@koush/wrtc')

class P2PT extends BrowserP2PT {
/**
Expand Down
13 changes: 11 additions & 2 deletions p2pt.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class P2PT extends EventEmitter {
* @param integer msgID ID of message if it's a response to a previous message
*/
send (peer, msg, msgID = '') {
return new Promise((resolve, reject) => {
return new Promise(async (resolve, reject) => {
const data = {
id: msgID !== '' ? msgID : Math.floor(Math.random() * 100000 + 100000),
msg
Expand Down Expand Up @@ -260,9 +260,18 @@ class P2PT extends EventEmitter {

data.msg = remaining
chunks++
if((chunks % 100) == 0){
await sleep(500);
}
}

setTimeout(()=>{
resolve(null);
},60000);
debug('sent a message to ' + peer.id)
//Waiting every 1.6M, thus preventing the peer from closing the connection because it thinks it is attacking DDOS, thus accepting files greater than 20M.
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
})
}

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
"test": "standard && start-server-and-test 'node start-trackers.js' 5001 test:all"
},
"dependencies": {
"wrtc": "^0.4.7",
"bittorrent-tracker": "^9.14.5",
"randombytes": "^2.1.0",
"simple-sha1": "^3.0.1"
},
"optionalDependencies": {
"wrtc": "^0.4.6"
"@koush/wrtc": "^0.5.3"
},
"devDependencies": {
"airtap": "^3.0.0",
Expand Down