Merge pull request #402 from murat-dogan/simple-fix

Simple fix
This commit is contained in:
Paul-Louis Ageneau
2021-04-13 21:49:51 +02:00
committed by GitHub
4 changed files with 9 additions and 9 deletions

View File

@ -2,7 +2,7 @@
"name": "libdatachannel-signaling-server", "name": "libdatachannel-signaling-server",
"version": "0.1.0", "version": "0.1.0",
"description": "Signaling server example for libdatachannel", "description": "Signaling server example for libdatachannel",
"main": "server.js", "main": "signaling-server.js",
"scripts": { "scripts": {
"start": "node signaling-server.js", "start": "node signaling-server.js",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"

View File

@ -17,7 +17,6 @@
* along with this program; If not, see <http://www.gnu.org/licenses/>. * along with this program; If not, see <http://www.gnu.org/licenses/>.
*/ */
const fs = require('fs');
const http = require('http'); const http = require('http');
const websocket = require('websocket'); const websocket = require('websocket');

View File

@ -121,12 +121,11 @@ size_t benchmark(milliseconds duration) {
} }
} catch (const std::exception &e) { } catch (const std::exception &e) {
std::cout << "Send failed: " << e.what() << std::endl; std::cout << "Send failed: " << e.what() << std::endl;
} }
// When sent data is buffered in the DataChannel,
// wait for onBufferedAmountLow callback to continue
}); });
// When sent data is buffered in the DataChannel,
// wait for onBufferedAmountLow callback to continue
dc1->onBufferedAmountLow([wdc1 = make_weak_ptr(dc1), &messageData]() { dc1->onBufferedAmountLow([wdc1 = make_weak_ptr(dc1), &messageData]() {
auto dc1 = wdc1.lock(); auto dc1 = wdc1.lock();
if (!dc1) if (!dc1)

View File

@ -24,6 +24,8 @@
#include <memory> #include <memory>
#include <thread> #include <thread>
#define CUSTOM_MAX_MESSAGE_SIZE 1048576
using namespace rtc; using namespace rtc;
using namespace std; using namespace std;
@ -39,7 +41,7 @@ void test_connectivity() {
// Custom MTU example // Custom MTU example
config1.mtu = 1500; config1.mtu = 1500;
// Custom max message size // Custom max message size
config1.maxMessageSize = 1048576; config1.maxMessageSize = CUSTOM_MAX_MESSAGE_SIZE;
PeerConnection pc1(config1); PeerConnection pc1(config1);
@ -50,7 +52,7 @@ void test_connectivity() {
// Custom MTU example // Custom MTU example
config2.mtu = 1500; config2.mtu = 1500;
// Custom max message size // Custom max message size
config2.maxMessageSize = 1048576; config2.maxMessageSize = CUSTOM_MAX_MESSAGE_SIZE;
// Port range example // Port range example
config2.portRangeBegin = 5000; config2.portRangeBegin = 5000;
config2.portRangeEnd = 6000; config2.portRangeEnd = 6000;
@ -144,7 +146,7 @@ void test_connectivity() {
if (!adc2 || !adc2->isOpen() || !dc1->isOpen()) if (!adc2 || !adc2->isOpen() || !dc1->isOpen())
throw runtime_error("DataChannel is not open"); throw runtime_error("DataChannel is not open");
if (dc1->maxMessageSize() != 1048576 || dc2->maxMessageSize() != 1048576) if (dc1->maxMessageSize() != CUSTOM_MAX_MESSAGE_SIZE || dc2->maxMessageSize() != CUSTOM_MAX_MESSAGE_SIZE)
throw runtime_error("DataChannel max message size is incorrect"); throw runtime_error("DataChannel max message size is incorrect");
if (auto addr = pc1.localAddress()) if (auto addr = pc1.localAddress())