Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
9bc4d37a
提交
9bc4d37a
authored
12月 31, 2015
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Distribute RTC ports between workers.
上级
b983c05e
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
35 行增加
和
8 行删除
+35
-8
Server.js
lib/Server.js
+27
-1
TCPServer.cpp
worker/src/RTC/TCPServer.cpp
+1
-1
UDPSocket.cpp
worker/src/RTC/UDPSocket.cpp
+1
-1
main.cpp
worker/src/main.cpp
+6
-5
没有找到文件。
lib/Server.js
浏览文件 @
9bc4d37a
...
@@ -46,6 +46,12 @@ class Server extends EventEmitter
...
@@ -46,6 +46,12 @@ class Server extends EventEmitter
if
(
options
.
rtcListenIPv6
===
null
||
options
.
rtcListenIPv6
===
undefined
)
if
(
options
.
rtcListenIPv6
===
null
||
options
.
rtcListenIPv6
===
undefined
)
delete
options
.
rtcListenIPv6
;
delete
options
.
rtcListenIPv6
;
if
(
!
check
.
greaterOrEqual
(
options
.
rtcMinPort
,
1024
))
options
.
rtcMinPort
=
10000
;
if
(
!
check
.
lessOrEqual
(
options
.
rtcMaxPort
,
65535
))
options
.
rtcMaxPort
=
59999
;
if
(
check
.
nonEmptyString
(
options
.
dtlsCertificateFile
))
if
(
check
.
nonEmptyString
(
options
.
dtlsCertificateFile
))
options
.
dtlsCertificateFile
=
path
.
resolve
(
options
.
dtlsCertificateFile
);
options
.
dtlsCertificateFile
=
path
.
resolve
(
options
.
dtlsCertificateFile
);
...
@@ -63,8 +69,28 @@ class Server extends EventEmitter
...
@@ -63,8 +69,28 @@ class Server extends EventEmitter
{
{
let
worker
;
let
worker
;
let
workerId
=
serverId
+
'#'
+
i
;
let
workerId
=
serverId
+
'#'
+
i
;
let
workerParameters
=
parameters
.
slice
(
0
);
// Distribute RTC ports for each worker
let
rtcMinPort
=
options
.
rtcMinPort
;
let
rtcMaxPort
=
options
.
rtcMaxPort
;
let
numPorts
=
Math
.
floor
((
rtcMaxPort
-
rtcMinPort
)
/
numWorkers
);
rtcMinPort
=
rtcMinPort
+
(
numPorts
*
(
i
-
1
));
rtcMaxPort
=
rtcMinPort
+
numPorts
;
if
(
rtcMinPort
%
2
!==
0
)
rtcMinPort
++
;
if
(
rtcMaxPort
%
2
===
0
)
rtcMaxPort
--
;
workerParameters
.
push
(
`--rtcMinPort=
${
rtcMinPort
}
`
);
workerParameters
.
push
(
`--rtcMaxPort=
${
rtcMaxPort
}
`
);
worker
=
new
Worker
(
workerId
,
parameters
);
// Create a Worker instance
worker
=
new
Worker
(
workerId
,
workerParameters
);
// Store the Worker instance and remove it when closed
// Store the Worker instance and remove it when closed
// Also, if it is the latest Worker then close the Server
// Also, if it is the latest Worker then close the Server
...
...
worker/src/RTC/TCPServer.cpp
浏览文件 @
9bc4d37a
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
#include "Logger.h"
#include "Logger.h"
#include <string>
#include <string>
#define MAX_BIND_ATTEMPTS
1000 // TODO: hack
#define MAX_BIND_ATTEMPTS
20
#define MAX_TCP_CONNECTIONS_PER_SERVER 10
#define MAX_TCP_CONNECTIONS_PER_SERVER 10
/* Static methods for UV callbacks. */
/* Static methods for UV callbacks. */
...
...
worker/src/RTC/UDPSocket.cpp
浏览文件 @
9bc4d37a
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
#include "Logger.h"
#include "Logger.h"
#include <string>
#include <string>
#define MAX_BIND_ATTEMPTS
1000 // TODO: hack
#define MAX_BIND_ATTEMPTS
20
/* Static methods for UV callbacks. */
/* Static methods for UV callbacks. */
...
...
worker/src/main.cpp
浏览文件 @
9bc4d37a
...
@@ -17,11 +17,10 @@
...
@@ -17,11 +17,10 @@
#include "Logger.h"
#include "Logger.h"
#include <map>
#include <map>
#include <string>
#include <string>
#include <iostream> // std::cout, std::cerr
#include <cstdlib> // std::_Exit(), std::genenv()
#include <cstdlib> // std::_Exit(), std::genenv()
#include <csignal> // sigaction()
#include <csignal> // sigaction()
#include <cerrno>
#include <cerrno>
#include <unistd.h> // getpid()
#include <unistd.h> // getpid()
, usleep()
#include <uv.h>
#include <uv.h>
static
void
init
();
static
void
init
();
...
@@ -51,7 +50,8 @@ int main(int argc, char* argv[], char** envp)
...
@@ -51,7 +50,8 @@ int main(int argc, char* argv[], char** envp)
}
}
catch
(
const
MediaSoupError
&
error
)
catch
(
const
MediaSoupError
&
error
)
{
{
std
::
cerr
<<
"failure exit: "
<<
error
.
what
()
<<
std
::
endl
;
MS_ERROR
(
"failed to start: %s"
,
error
.
what
());
usleep
(
100000
);
std
::
_Exit
(
EXIT_FAILURE
);
std
::
_Exit
(
EXIT_FAILURE
);
}
}
...
@@ -82,13 +82,14 @@ int main(int argc, char* argv[], char** envp)
...
@@ -82,13 +82,14 @@ int main(int argc, char* argv[], char** envp)
Loop
loop
(
channel
);
Loop
loop
(
channel
);
destroy
();
destroy
();
std
::
cout
<<
"success exit"
<<
std
::
endl
;
MS_DEBUG_STD
(
"success exit"
)
;
std
::
_Exit
(
EXIT_SUCCESS
);
std
::
_Exit
(
EXIT_SUCCESS
);
}
}
catch
(
const
MediaSoupError
&
error
)
catch
(
const
MediaSoupError
&
error
)
{
{
destroy
();
destroy
();
std
::
cerr
<<
"failure exit: "
<<
error
.
what
()
<<
std
::
endl
;
MS_ERROR_STD
(
"failure exit: %s"
,
error
.
what
());
usleep
(
100000
);
std
::
_Exit
(
EXIT_FAILURE
);
std
::
_Exit
(
EXIT_FAILURE
);
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论