Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
aa587a71
提交
aa587a71
authored
12月 12, 2015
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove Syslog stuff.
上级
d899c399
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
23 个修改的文件
包含
115 行增加
和
192 行删除
+115
-192
.gitignore
.gitignore
+1
-0
Server.js
lib/Server.js
+13
-4
mediasoup-worker
worker/bin/mediasoup-worker
+0
-0
Logger.h
worker/include/Logger.h
+14
-83
DTLSRole.h
worker/include/RTC/DTLSRole.h
+3
-2
Settings.h
worker/include/Settings.h
+10
-24
common.h
worker/include/common.h
+6
-0
DepLibSRTP.cpp
worker/src/DepLibSRTP.cpp
+1
-1
DepUsrSCTP.cpp
worker/src/DepUsrSCTP.cpp
+1
-1
Logger.cpp
worker/src/Logger.cpp
+0
-12
Loop.cpp
worker/src/Loop.cpp
+3
-3
DTLSHandler.cpp
worker/src/RTC/DTLSHandler.cpp
+13
-18
ICEServer.cpp
worker/src/RTC/ICEServer.cpp
+1
-1
Peer.cpp
worker/src/RTC/Peer.cpp
+3
-3
SRTPSession.cpp
worker/src/RTC/SRTPSession.cpp
+1
-1
TCPServer.cpp
worker/src/RTC/TCPServer.cpp
+10
-10
Transport.cpp
worker/src/RTC/Transport.cpp
+5
-5
UDPSocket.cpp
worker/src/RTC/UDPSocket.cpp
+10
-10
Settings.cpp
worker/src/Settings.cpp
+0
-0
TCPConnection.cpp
worker/src/handles/TCPConnection.cpp
+5
-5
UDPSocket.cpp
worker/src/handles/UDPSocket.cpp
+4
-4
UnixStreamSocket.cpp
worker/src/handles/UnixStreamSocket.cpp
+4
-4
main.cpp
worker/src/main.cpp
+7
-1
没有找到文件。
.gitignore
浏览文件 @
aa587a71
...
...
@@ -5,3 +5,4 @@
/worker/cldoc/
/worker/mediasoup-tester.sh
/TODO
/test.js
lib/Server.js
浏览文件 @
aa587a71
...
...
@@ -17,8 +17,8 @@ const WORKER_BIN_PATH = path.join(__dirname, '..', 'worker', 'bin', 'mediasoup-w
const
DEFAULT_NUM_WORKERS
=
Object
.
keys
(
os
.
cpus
()).
length
;
const
VALID_PARAMETERS
=
[
'logLevel'
,
'
useSyslog'
,
'syslogFacility'
,
'rtcListenIPv4'
,
'rtcListenIPv6
'
,
'
rtcMinPort'
,
'rtcMaxPort'
,
'
dtlsCertificateFile'
,
'dtlsPrivateKeyFile'
'logLevel'
,
'
rtcListenIPv4'
,
'rtcListenIPv6'
,
'rtcMinPort'
,
'rtcMaxPort
'
,
'dtlsCertificateFile'
,
'dtlsPrivateKeyFile'
];
var
servers
=
new
Set
();
...
...
@@ -67,12 +67,19 @@ class Server
// Create mediasoup-worker child processes
for
(
let
i
=
1
;
i
<=
numWorkers
;
i
++
)
{
let
workerId
=
serverId
+
'#'
+
i
;
let
worker
;
let
workerId
=
serverId
+
'#'
+
i
;
let
spawnArgs
=
[
workerId
].
concat
(
parameters
);
let
spawnOptions
=
{
detached
:
false
,
stdio
:
[
'pipe'
,
'pipe'
,
'pipe'
,
'ipc'
]
};
debug
(
'constructor() | creating worker [workerId:%s]'
,
workerId
);
worker
=
spawn
(
WORKER_BIN_PATH
,
[
workerId
].
concat
(
parameters
));
// Create the worker child process
worker
=
spawn
(
WORKER_BIN_PATH
,
spawnArgs
,
spawnOptions
);
// Store worker id within the worker process
worker
.
workerId
=
workerId
;
...
...
@@ -102,6 +109,8 @@ class Server
worker
.
on
(
'exit'
,
(
code
,
signal
)
=>
{
debug
(
'worker process closed [workerId:%s, code:%s, signal:%s]'
,
worker
.
workerId
,
code
,
signal
);
this
.
_workers
.
delete
(
worker
.
workerId
);
});
worker
.
on
(
'error'
,
(
error
)
=>
...
...
worker/bin/mediasoup-worker
deleted
100755 → 0
浏览文件 @
d899c399
File deleted
worker/include/Logger.h
浏览文件 @
aa587a71
...
...
@@ -8,10 +8,6 @@
#include <cstring>
#include <cstdlib> // std::_Exit(), std::abort()
#include <uv.h>
extern
"C"
{
#include <syslog.h>
}
/*
* Logger facility.
...
...
@@ -24,10 +20,8 @@ extern "C"
* - MS_TRACE() Shows current file/line/class/function.
* - MS_DEBUG(...)
* - MS_INFO(...)
* - MS_NOTICE(...)
* - MS_WARN(...)
* - MS_ERROR(...)
* - MS_CRIT(...)
* - MS_ABORT(...)
*
* Arguments to those macros (except MS_TRACE) have the same format as printf.
...
...
@@ -45,7 +39,7 @@ extern "C"
/*
* This macro must point to a unsigned int function, method or variable that
* returns the
Syslog
logging level.
* returns the logging level.
*/
#define MS_GET_LOG_LEVEL Settings::configuration.logLevel
...
...
@@ -55,14 +49,11 @@ public:
static
void
Init
(
const
std
::
string
id
);
static
const
char
*
GetProcessName
();
static
const
char
*
GetProcessMinName
();
static
void
EnableSyslog
();
static
bool
IsSyslogEnabled
();
static
bool
HasDebugLevel
();
private
:
static
std
::
string
processName
;
static
std
::
string
processMinName
;
static
bool
isSyslogEnabled
;
};
/* Inline static methods. */
...
...
@@ -79,16 +70,10 @@ const char* Logger::GetProcessMinName()
return
Logger
::
processMinName
.
c_str
();
}
inline
bool
Logger
::
IsSyslogEnabled
()
{
return
Logger
::
isSyslogEnabled
;
}
inline
bool
Logger
::
HasDebugLevel
()
{
return
(
LOG
_DEBUG
==
MS_GET_LOG_LEVEL
);
return
(
MS_LOG_LEVEL
_DEBUG
==
MS_GET_LOG_LEVEL
);
}
// NOTE: Each file including Logger.h MUST define its own MS_CLASS macro.
...
...
@@ -105,53 +90,22 @@ bool Logger::HasDebugLevel()
#endif
#define _MS_TO_STDOUT() \
if (!Logger::IsSyslogEnabled()) \
{ \
std::fprintf(stdout, _MS_LOG_STR "\n", _MS_LOG_ARG); \
fflush(stdout); \
}
std::fprintf(stdout, _MS_LOG_STR "\n", _MS_LOG_ARG); \
fflush(stdout);
#define _MS_TO_STDOUT_DESC(desc, ...) \
if (!Logger::IsSyslogEnabled()) \
{ \
std::fprintf(stdout, _MS_LOG_STR_DESC desc "\n", _MS_LOG_ARG, ##__VA_ARGS__); \
fflush(stdout); \
}
std::fprintf(stdout, _MS_LOG_STR_DESC desc "\n", _MS_LOG_ARG, ##__VA_ARGS__); \
fflush(stdout); \
#define _MS_TO_STDERR_DESC(desc, ...) \
if (!Logger::IsSyslogEnabled()) \
{ \
std::fprintf(stderr, _MS_LOG_STR_DESC desc "\n", _MS_LOG_ARG, ##__VA_ARGS__); \
fflush(stderr); \
}
#define _MS_TO_SYSLOG(severity, prefix) \
if (Logger::IsSyslogEnabled()) \
syslog(severity, prefix _MS_LOG_STR, _MS_LOG_ARG);
#define _MS_TO_SYSLOG_DESC(severity, prefix, desc, ...) \
if (Logger::IsSyslogEnabled()) \
syslog(severity, prefix _MS_LOG_STR_DESC desc, _MS_LOG_ARG, ##__VA_ARGS__);
/*
* Log levels in syslog.h:
*
* LOG_EMERG 0 system is unusable
* LOG_ALERT 1 action must be taken immediately
* LOG_CRIT 2 critical conditions
* LOG_ERR 3 error conditions
* LOG_WARNING 4 warning conditions
* LOG_NOTICE 5 normal but significant condition
* LOG_INFO 6 informational
* LOG_DEBUG 7 debug-level messages
*/
std::fprintf(stderr, _MS_LOG_STR_DESC desc "\n", _MS_LOG_ARG, ##__VA_ARGS__); \
fflush(stderr); \
#ifdef MS_DEVEL
#define MS_TRACE() \
do \
{ \
_MS_TO_STDOUT(); \
_MS_TO_SYSLOG(LOG_DEBUG, "TRACE "); \
} \
while (0)
#else
...
...
@@ -161,10 +115,9 @@ bool Logger::HasDebugLevel()
#define MS_DEBUG(desc, ...) \
do \
{ \
if (
LOG
_DEBUG == MS_GET_LOG_LEVEL) \
if (
MS_LOG_LEVEL
_DEBUG == MS_GET_LOG_LEVEL) \
{ \
_MS_TO_STDOUT_DESC(desc, ##__VA_ARGS__); \
_MS_TO_SYSLOG_DESC(LOG_DEBUG, "DEBUG ", desc, ##__VA_ARGS__); \
} \
} \
while (0)
...
...
@@ -172,21 +125,9 @@ bool Logger::HasDebugLevel()
#define MS_INFO(desc, ...) \
do \
{ \
if (LOG_INFO <= MS_GET_LOG_LEVEL) \
{ \
_MS_TO_STDOUT_DESC(desc, ##__VA_ARGS__); \
_MS_TO_SYSLOG_DESC(LOG_INFO, "INFO ", desc, ##__VA_ARGS__); \
} \
} \
while (0)
#define MS_NOTICE(desc, ...) \
do \
{ \
if (LOG_NOTICE <= MS_GET_LOG_LEVEL) \
if (MS_LOG_LEVEL_INFO <= MS_GET_LOG_LEVEL) \
{ \
_MS_TO_STDOUT_DESC(desc, ##__VA_ARGS__); \
_MS_TO_SYSLOG_DESC(LOG_NOTICE, "NOTICE ", desc, ##__VA_ARGS__); \
} \
} \
while (0)
...
...
@@ -194,10 +135,9 @@ bool Logger::HasDebugLevel()
#define MS_WARN(desc, ...) \
do \
{ \
if (
LOG_WARNING
<= MS_GET_LOG_LEVEL) \
if (
MS_LOG_LEVEL_WARN
<= MS_GET_LOG_LEVEL) \
{ \
_MS_TO_STDERR_DESC(desc, ##__VA_ARGS__); \
_MS_TO_SYSLOG_DESC(LOG_WARNING, "WARN ", desc, ##__VA_ARGS__); \
} \
} \
while (0)
...
...
@@ -206,22 +146,13 @@ bool Logger::HasDebugLevel()
do \
{ \
_MS_TO_STDERR_DESC(desc, ##__VA_ARGS__); \
_MS_TO_SYSLOG_DESC(LOG_ERR, "ERROR ", desc, ##__VA_ARGS__); \
} \
while (0)
#define MS_CRIT(desc, ...) \
do \
{ \
_MS_TO_STDERR_DESC(desc, ##__VA_ARGS__); \
_MS_TO_SYSLOG_DESC(LOG_ERR, "CRIT ", desc, ##__VA_ARGS__); \
} \
while (0)
#define MS_EXIT_SUCCESS(desc, ...) \
do \
{ \
MS_
NOTICE
("SUCCESS EXIT | " desc, ##__VA_ARGS__); \
MS_
INFO
("SUCCESS EXIT | " desc, ##__VA_ARGS__); \
std::_Exit(EXIT_SUCCESS); \
} \
while (0)
...
...
@@ -229,7 +160,7 @@ bool Logger::HasDebugLevel()
#define MS_EXIT_FAILURE(desc, ...) \
do \
{ \
MS_
CRIT
("FAILURE EXIT | " desc, ##__VA_ARGS__); \
MS_
ERROR
("FAILURE EXIT | " desc, ##__VA_ARGS__); \
std::_Exit(EXIT_FAILURE); \
} \
while (0)
...
...
@@ -237,7 +168,7 @@ bool Logger::HasDebugLevel()
#define MS_ABORT(desc, ...) \
do \
{ \
MS_
CRIT
("ABORT | " desc, ##__VA_ARGS__); \
MS_
ERROR
("ABORT | " desc, ##__VA_ARGS__); \
std::abort(); \
} \
while (0)
...
...
worker/include/RTC/DTLSRole.h
浏览文件 @
aa587a71
#ifndef MS_RTC_DTLS_ROLE_H
#define MS_RTC_DTLS_ROLE_H
namespace
RTC
{
namespace
RTC
{
enum
class
DTLSRole
{
NONE
=
0
,
SERVER
=
1
,
CLIENT
};
}
// namespace RTC
}
#endif
worker/include/Settings.h
浏览文件 @
aa587a71
...
...
@@ -4,10 +4,6 @@
#include "common.h"
#include <map>
#include <string>
extern
"C"
{
#include <syslog.h>
}
class
Settings
{
...
...
@@ -15,23 +11,16 @@ public:
// Struct holding the configuration.
struct
Configuration
{
unsigned
int
logLevel
{
LOG_DEBUG
};
bool
useSyslog
{
false
};
unsigned
int
syslogFacility
{
LOG_USER
};
struct
{
std
::
string
listenIPv4
;
std
::
string
listenIPv6
;
MS_PORT
minPort
{
10000
};
MS_PORT
maxPort
{
59999
};
std
::
string
dtlsCertificateFile
;
std
::
string
dtlsPrivateKeyFile
;
// Private fields.
bool
hasIPv4
{
false
};
bool
hasIPv6
{
false
};
}
RTC
;
unsigned
int
logLevel
{
MS_LOG_LEVEL_DEBUG
};
std
::
string
rtcListenIPv4
;
std
::
string
rtcListenIPv6
;
MS_PORT
rtcMinPort
{
10000
};
MS_PORT
rtcMaxPort
{
59999
};
std
::
string
dtlsCertificateFile
;
std
::
string
dtlsPrivateKeyFile
;
// Private fields.
bool
hasIPv4
{
false
};
bool
hasIPv6
{
false
};
};
public
:
...
...
@@ -41,7 +30,6 @@ public:
private
:
static
void
SetDefaultRtcListenIP
(
int
requested_family
);
static
void
SetLogLevel
(
std
::
string
&
level
);
static
void
SetSyslogFacility
(
std
::
string
&
facility
);
static
void
SetRtcListenIPv4
(
const
std
::
string
&
ip
);
static
void
SetRtcListenIPv6
(
const
std
::
string
&
ip
);
static
void
SetRtcPorts
();
...
...
@@ -53,8 +41,6 @@ public:
private
:
static
std
::
map
<
std
::
string
,
unsigned
int
>
string2LogLevel
;
static
std
::
map
<
unsigned
int
,
std
::
string
>
logLevel2String
;
static
std
::
map
<
std
::
string
,
unsigned
int
>
string2SyslogFacility
;
static
std
::
map
<
unsigned
int
,
std
::
string
>
syslogFacility2String
;
};
#endif
worker/include/common.h
浏览文件 @
aa587a71
...
...
@@ -7,9 +7,15 @@
#include <netinet/in.h> // sockaddr_in, sockaddr_in6
#include <arpa/inet.h> // htonl(), htons(), ntohl(), ntohs()
#define MS_APP_NAME "mediasoup"
#define MS_PROCESS_NAME "mediasoup-worker"
#define MS_PROCESS_MIN_NAME "worker"
#define MS_LOG_LEVEL_DEBUG 3
#define MS_LOG_LEVEL_INFO 2
#define MS_LOG_LEVEL_WARN 1
#define MS_LOG_LEVEL_ERROR 0
#define MS_BYTE uint8_t
#define MS_2BYTES uint16_t
#define MS_4BYTES uint32_t
...
...
worker/src/DepLibSRTP.cpp
浏览文件 @
aa587a71
...
...
@@ -57,5 +57,5 @@ void DepLibSRTP::ClassDestroy()
err
=
srtp_shutdown
();
if
(
DepLibSRTP
::
IsError
(
err
))
MS_
CRIT
(
"srtp_shutdown() failed: %s"
,
DepLibSRTP
::
GetErrorString
(
err
));
MS_
ERROR
(
"srtp_shutdown() failed: %s"
,
DepLibSRTP
::
GetErrorString
(
err
));
}
worker/src/DepUsrSCTP.cpp
浏览文件 @
aa587a71
...
...
@@ -25,5 +25,5 @@ void DepUsrSCTP::ClassDestroy()
// Free usrsctp.
err
=
usrsctp_finish
();
if
(
err
)
MS_
CRIT
(
"usrsctp_finish() failed"
);
MS_
ERROR
(
"usrsctp_finish() failed"
);
}
worker/src/Logger.cpp
浏览文件 @
aa587a71
...
...
@@ -6,7 +6,6 @@
std
::
string
Logger
::
processName
;
std
::
string
Logger
::
processMinName
;
bool
Logger
::
isSyslogEnabled
=
false
;
/* Static methods. */
...
...
@@ -17,14 +16,3 @@ void Logger::Init(const std::string id)
MS_TRACE
();
}
void
Logger
::
EnableSyslog
()
{
MS_TRACE
();
MS_DEBUG
(
"logging to Syslog"
);
openlog
(
MS_PROCESS_NAME
,
(
LOG_PID
),
Settings
::
configuration
.
syslogFacility
);
Logger
::
isSyslogEnabled
=
true
;
}
worker/src/Loop.cpp
浏览文件 @
aa587a71
...
...
@@ -62,17 +62,17 @@ void Loop::onSignal(SignalsHandler* signalsHandler, int signum)
switch
(
signum
)
{
case
SIGINT
:
MS_
NOTICE
(
"signal INT received, exiting"
);
MS_
DEBUG
(
"signal INT received, exiting"
);
Close
();
break
;
case
SIGTERM
:
MS_
NOTICE
(
"signal TERM received, exiting"
);
MS_
DEBUG
(
"signal TERM received, exiting"
);
Close
();
break
;
default
:
MS_
ERROR
(
"received a signal (with signum %d) for which there is no handling code"
,
signum
);
MS_
WARN
(
"received a signal (with signum %d) for which there is no handling code"
,
signum
);
}
}
...
...
worker/src/RTC/DTLSHandler.cpp
浏览文件 @
aa587a71
...
...
@@ -84,7 +84,7 @@ namespace RTC
MS_TRACE
();
// Generate a X509 certificate and private key (unless PEM files are provided).
if
(
Settings
::
configuration
.
RTC
.
dtlsCertificateFile
.
empty
()
||
Settings
::
configuration
.
RTC
.
dtlsPrivateKeyFile
.
empty
())
if
(
Settings
::
configuration
.
dtlsCertificateFile
.
empty
()
||
Settings
::
configuration
.
dtlsPrivateKeyFile
.
empty
())
GenerateCertificateAndPrivateKey
();
else
ReadCertificateAndPrivateKeyFromFiles
();
...
...
@@ -207,8 +207,8 @@ namespace RTC
LOG_OPENSSL_ERROR
(
"X509_get_subject_name() failed"
);
goto
error
;
}
X509_NAME_add_entry_by_txt
(
cert_name
,
"O"
,
MBSTRING_ASC
,
(
unsigned
char
*
)
MS_
PROCESS
_NAME
,
-
1
,
-
1
,
0
);
X509_NAME_add_entry_by_txt
(
cert_name
,
"CN"
,
MBSTRING_ASC
,
(
unsigned
char
*
)
MS_
PROCESS
_NAME
,
-
1
,
-
1
,
0
);
X509_NAME_add_entry_by_txt
(
cert_name
,
"O"
,
MBSTRING_ASC
,
(
unsigned
char
*
)
MS_
APP
_NAME
,
-
1
,
-
1
,
0
);
X509_NAME_add_entry_by_txt
(
cert_name
,
"CN"
,
MBSTRING_ASC
,
(
unsigned
char
*
)
MS_
APP
_NAME
,
-
1
,
-
1
,
0
);
// It is self signed so set the issuer name to be the same as the subject.
ret
=
X509_set_issuer_name
(
DTLSHandler
::
certificate
,
cert_name
);
...
...
@@ -249,7 +249,7 @@ namespace RTC
FILE
*
file
=
nullptr
;
file
=
fopen
(
Settings
::
configuration
.
RTC
.
dtlsCertificateFile
.
c_str
(),
"r"
);
file
=
fopen
(
Settings
::
configuration
.
dtlsCertificateFile
.
c_str
(),
"r"
);
if
(
!
file
)
{
MS_ERROR
(
"error reading DTLS certificate file: %s"
,
std
::
strerror
(
errno
));
...
...
@@ -263,7 +263,7 @@ namespace RTC
}
fclose
(
file
);
file
=
fopen
(
Settings
::
configuration
.
RTC
.
dtlsPrivateKeyFile
.
c_str
(),
"r"
);
file
=
fopen
(
Settings
::
configuration
.
dtlsPrivateKeyFile
.
c_str
(),
"r"
);
if
(
!
file
)
{
MS_ERROR
(
"error reading DTLS private key file: %s"
,
std
::
strerror
(
errno
));
...
...
@@ -694,7 +694,7 @@ namespace RTC
{
if
(
!
this
->
isConnected
)
{
MS_
NOTICE
(
"ignoring application data received while DTLS not fully connected"
);
MS_
DEBUG
(
"ignoring application data received while DTLS not fully connected"
);
return
;
}
...
...
@@ -760,33 +760,28 @@ namespace RTC
switch
(
err
)
{
case
SSL_ERROR_NONE
:
// MS_DEBUG("SSL status: SSL_ERROR_NONE");
break
;
case
SSL_ERROR_SSL
:
// MS_NOTICE("SSL status: SSL_ERROR_SSL");
LOG_OPENSSL_ERROR
(
"SSL status: SSL_ERROR_SSL"
);
break
;
case
SSL_ERROR_WANT_READ
:
// MS_DEBUG("SSL status: SSL_ERROR_WANT_READ");
break
;
case
SSL_ERROR_WANT_WRITE
:
MS_DEBUG
(
"SSL status: SSL_ERROR_WANT_WRITE"
);
break
;
case
SSL_ERROR_WANT_X509_LOOKUP
:
MS_
NOTICE
(
"SSL status: SSL_ERROR_WANT_X509_LOOKUP"
);
MS_
DEBUG
(
"SSL status: SSL_ERROR_WANT_X509_LOOKUP"
);
break
;
case
SSL_ERROR_SYSCALL
:
// MS_WARN("SSL status: SSL_ERROR_SYSCALL");
LOG_OPENSSL_ERROR
(
"SSL status: SSL_ERROR_SYSCALL"
);
break
;
case
SSL_ERROR_ZERO_RETURN
:
// MS_DEBUG("SSL status: SSL_ERROR_ZERO_RETURN");
break
;
case
SSL_ERROR_WANT_CONNECT
:
MS_
WARN
(
"SSL status: SSL_ERROR_WANT_CONNECT"
);
MS_
DEBUG
(
"SSL status: SSL_ERROR_WANT_CONNECT"
);
break
;
case
SSL_ERROR_WANT_ACCEPT
:
MS_
WARN
(
"SSL status: SSL_ERROR_WANT_ACCEPT"
);
MS_
DEBUG
(
"SSL status: SSL_ERROR_WANT_ACCEPT"
);
break
;
}
...
...
@@ -822,7 +817,7 @@ namespace RTC
}
else
{
MS_
NOTICE
(
"DTLS connection failed"
);
MS_
DEBUG
(
"DTLS connection failed"
);
// Notify to the listener.
this
->
listener
->
onDTLSFailed
(
this
);
...
...
@@ -949,7 +944,7 @@ namespace RTC
}
else
{
MS_
NOTICE
(
"SRTP profile not negotiated"
);
MS_
DEBUG
(
"SRTP profile not negotiated"
);
}
}
...
...
@@ -1021,7 +1016,7 @@ namespace RTC
if
(
this
->
remoteFingerprint
.
compare
(
hex_fingerprint
)
!=
0
)
{
MS_
NOTICE
(
"fingerprint in the remote certificate (%s) does not match the announced one (%s)"
,
hex_fingerprint
,
this
->
remoteFingerprint
.
c_str
());
MS_
DEBUG
(
"fingerprint in the remote certificate (%s) does not match the announced one (%s)"
,
hex_fingerprint
,
this
->
remoteFingerprint
.
c_str
());
return
false
;
}
...
...
@@ -1145,7 +1140,7 @@ namespace RTC
else
if
(
where
&
SSL_CB_EXIT
)
{
if
(
ret
==
0
)
MS_
NOTICE
(
"role: %s | failed in: %s"
,
role
,
SSL_state_string_long
(
this
->
ssl
));
MS_
DEBUG
(
"role: %s | failed in: %s"
,
role
,
SSL_state_string_long
(
this
->
ssl
));
else
if
(
ret
<
0
)
MS_DEBUG
(
"role: %s | waiting for: %s"
,
role
,
SSL_state_string_long
(
this
->
ssl
));
}
...
...
worker/src/RTC/ICEServer.cpp
浏览文件 @
aa587a71
...
...
@@ -126,7 +126,7 @@ namespace RTC
// The remote peer must be ICE controlling.
if
(
msg
->
GetIceControlled
())
{
MS_
NOTICE
(
"peer indicates ICE-CONTROLLED in STUN Binding Request => 487"
);
MS_
DEBUG
(
"peer indicates ICE-CONTROLLED in STUN Binding Request => 487"
);
// Reply 487 (Role Conflict).
RTC
::
STUNMessage
*
response
=
msg
->
CreateErrorResponse
(
487
);
...
...
worker/src/RTC/Peer.cpp
浏览文件 @
aa587a71
...
...
@@ -36,7 +36,7 @@ namespace RTC
{
RTC
::
UDPSocket
*
socket
=
RTC
::
UDPSocket
::
New
(
AF_INET
);
this
->
transport
->
AddUDPSocket
(
socket
);
MS_
NOTICE
(
"---- TEST: transport listens in IPv4 UDP '%s' : %u"
,
socket
->
GetLocalIP
().
c_str
(),
socket
->
GetLocalPort
());
MS_
INFO
(
"---- TEST: transport listens in IPv4 UDP '%s' : %u"
,
socket
->
GetLocalIP
().
c_str
(),
socket
->
GetLocalPort
());
}
catch
(
const
MediaSoupError
&
error
)
{
...
...
@@ -47,7 +47,7 @@ namespace RTC
{
RTC
::
TCPServer
*
server
=
RTC
::
TCPServer
::
New
(
AF_INET
);
this
->
transport
->
AddTCPServer
(
server
);
MS_
NOTICE
(
"---- TEST: transport listens in IPv4 TCP '%s' : %u"
,
server
->
GetLocalIP
().
c_str
(),
server
->
GetLocalPort
());
MS_
INFO
(
"---- TEST: transport listens in IPv4 TCP '%s' : %u"
,
server
->
GetLocalIP
().
c_str
(),
server
->
GetLocalPort
());
}
catch
(
const
MediaSoupError
&
error
)
{
...
...
@@ -112,4 +112,4 @@ namespace RTC
this
->
listener
->
onRTCPPacket
(
this
,
packet
);
}
}
// namespace RTC
}
worker/src/RTC/SRTPSession.cpp
浏览文件 @
aa587a71
...
...
@@ -51,7 +51,7 @@ namespace RTC
break
;
}
MS_
NOTICE
(
"SSRC %llu: %s"
,
(
unsigned
long
long
)
data
->
stream
->
ssrc
,
event_desc
);
MS_
WARN
(
"SSRC %llu: %s"
,
(
unsigned
long
long
)
data
->
stream
->
ssrc
,
event_desc
);
}
/* Instance methods. */
...
...
worker/src/RTC/TCPServer.cpp
浏览文件 @
aa587a71
...
...
@@ -41,22 +41,22 @@ namespace RTC
int
err
;
if
(
!
Settings
::
configuration
.
RTC
.
l
istenIPv4
.
empty
())
if
(
!
Settings
::
configuration
.
rtcL
istenIPv4
.
empty
())
{
err
=
uv_ip4_addr
(
Settings
::
configuration
.
RTC
.
l
istenIPv4
.
c_str
(),
0
,
(
struct
sockaddr_in
*
)
&
RTC
::
TCPServer
::
sockaddrStorageIPv4
);
err
=
uv_ip4_addr
(
Settings
::
configuration
.
rtcL
istenIPv4
.
c_str
(),
0
,
(
struct
sockaddr_in
*
)
&
RTC
::
TCPServer
::
sockaddrStorageIPv4
);
if
(
err
)
MS_ABORT
(
"uv_ipv4_addr() failed: %s"
,
uv_strerror
(
err
));
}
if
(
!
Settings
::
configuration
.
RTC
.
l
istenIPv6
.
empty
())
if
(
!
Settings
::
configuration
.
rtcL
istenIPv6
.
empty
())
{
err
=
uv_ip6_addr
(
Settings
::
configuration
.
RTC
.
l
istenIPv6
.
c_str
(),
0
,
(
struct
sockaddr_in6
*
)
&
RTC
::
TCPServer
::
sockaddrStorageIPv6
);
err
=
uv_ip6_addr
(
Settings
::
configuration
.
rtcL
istenIPv6
.
c_str
(),
0
,
(
struct
sockaddr_in6
*
)
&
RTC
::
TCPServer
::
sockaddrStorageIPv6
);
if
(
err
)
MS_ABORT
(
"uv_ipv6_addr() failed: %s"
,
uv_strerror
(
err
));
}
TCPServer
::
minPort
=
Settings
::
configuration
.
RTC
.
m
inPort
;
TCPServer
::
maxPort
=
Settings
::
configuration
.
RTC
.
m
axPort
;
TCPServer
::
minPort
=
Settings
::
configuration
.
rtcM
inPort
;
TCPServer
::
maxPort
=
Settings
::
configuration
.
rtcM
axPort
;
MS_PORT
i
=
RTC
::
TCPServer
::
minPort
;
do
...
...
@@ -98,9 +98,9 @@ namespace RTC
{
MS_TRACE
();
if
(
address_family
==
AF_INET
&&
!
Settings
::
configuration
.
RTC
.
hasIPv4
)
if
(
address_family
==
AF_INET
&&
!
Settings
::
configuration
.
hasIPv4
)
MS_THROW_ERROR
(
"IPv4 family not available for RTC"
);
else
if
(
address_family
==
AF_INET6
&&
!
Settings
::
configuration
.
RTC
.
hasIPv6
)
else
if
(
address_family
==
AF_INET6
&&
!
Settings
::
configuration
.
hasIPv6
)
MS_THROW_ERROR
(
"IPv6 family not available for RTC"
);
int
err
;
...
...
@@ -121,14 +121,14 @@ namespace RTC
available_ports
=
&
RTC
::
TCPServer
::
availableIPv4Ports
;
first_bind_addr
=
RTC
::
TCPServer
::
sockaddrStorageIPv4
;
second_bind_addr
=
RTC
::
TCPServer
::
sockaddrStorageIPv4
;
listenIP
=
Settings
::
configuration
.
RTC
.
l
istenIPv4
.
c_str
();
listenIP
=
Settings
::
configuration
.
rtcL
istenIPv4
.
c_str
();
break
;
case
AF_INET6
:
available_ports
=
&
RTC
::
TCPServer
::
availableIPv6Ports
;
first_bind_addr
=
RTC
::
TCPServer
::
sockaddrStorageIPv6
;
second_bind_addr
=
RTC
::
TCPServer
::
sockaddrStorageIPv6
;
listenIP
=
Settings
::
configuration
.
RTC
.
l
istenIPv6
.
c_str
();
listenIP
=
Settings
::
configuration
.
rtcL
istenIPv6
.
c_str
();
// Don't also bind into IPv4 when listening in IPv6.
flags
|=
UV_TCP_IPV6ONLY
;
break
;
...
...
worker/src/RTC/Transport.cpp
浏览文件 @
aa587a71
...
...
@@ -427,7 +427,7 @@ namespace RTC
RTC
::
RTPPacket
*
packet
=
RTC
::
RTPPacket
::
Parse
(
data
,
len
);
if
(
!
packet
)
{
MS_
NOTICE
(
"data received via %s is not a valid RTP packet"
,
TRANSPORT_NAME
(
source
));
MS_
DEBUG
(
"data received via %s is not a valid RTP packet"
,
TRANSPORT_NAME
(
source
));
return
;
}
// MS_DEBUG("valid RTP packet received via %s [ssrc: %llu | payload: %hu | size: %zu]",
...
...
@@ -460,7 +460,7 @@ namespace RTC
if
(
!
this
->
srtpRecvSession
->
DecryptSRTCP
(
data
,
&
len
))
{
MS_
WARN
(
"error decrypting SRTCP packet received via %s: %s"
,
TRANSPORT_NAME
(
source
),
this
->
srtpRecvSession
->
GetLastErrorDesc
());
MS_
DEBUG
(
"error decrypting SRTCP packet received via %s: %s"
,
TRANSPORT_NAME
(
source
),
this
->
srtpRecvSession
->
GetLastErrorDesc
());
return
;
}
}
...
...
@@ -468,7 +468,7 @@ namespace RTC
RTC
::
RTCPPacket
*
packet
=
RTC
::
RTCPPacket
::
Parse
(
data
,
len
);
if
(
!
packet
)
{
MS_
NOTICE
(
"data received via %s is not a valid RTCP packet"
,
TRANSPORT_NAME
(
source
));
MS_
DEBUG
(
"data received via %s is not a valid RTCP packet"
,
TRANSPORT_NAME
(
source
));
return
;
}
// MS_DEBUG("valid RTCP packet received via %s", TRANSPORT_NAME(source));
...
...
@@ -598,7 +598,7 @@ namespace RTC
if
(
!
this
->
sendingSource
)
{
MS_
ERROR
(
"no sending address set, cannot send DTLS packet"
);
MS_
WARN
(
"no sending address set, cannot send DTLS packet"
);
return
;
}
...
...
@@ -630,7 +630,7 @@ namespace RTC
{
MS_TRACE
();
MS_
NOTICE
(
"DTLS failed"
);
MS_
DEBUG
(
"DTLS failed"
);
Reset
();
Dump
();
...
...
worker/src/RTC/UDPSocket.cpp
浏览文件 @
aa587a71
...
...
@@ -41,22 +41,22 @@ namespace RTC
int
err
;
if
(
Settings
::
configuration
.
RTC
.
hasIPv4
)
if
(
Settings
::
configuration
.
hasIPv4
)
{
err
=
uv_ip4_addr
(
Settings
::
configuration
.
RTC
.
l
istenIPv4
.
c_str
(),
0
,
(
struct
sockaddr_in
*
)
&
RTC
::
UDPSocket
::
sockaddrStorageIPv4
);
err
=
uv_ip4_addr
(
Settings
::
configuration
.
rtcL
istenIPv4
.
c_str
(),
0
,
(
struct
sockaddr_in
*
)
&
RTC
::
UDPSocket
::
sockaddrStorageIPv4
);
if
(
err
)
MS_ABORT
(
"uv_ipv4_addr() failed: %s"
,
uv_strerror
(
err
));
}
if
(
Settings
::
configuration
.
RTC
.
hasIPv6
)
if
(
Settings
::
configuration
.
hasIPv6
)
{
err
=
uv_ip6_addr
(
Settings
::
configuration
.
RTC
.
l
istenIPv6
.
c_str
(),
0
,
(
struct
sockaddr_in6
*
)
&
RTC
::
UDPSocket
::
sockaddrStorageIPv6
);
err
=
uv_ip6_addr
(
Settings
::
configuration
.
rtcL
istenIPv6
.
c_str
(),
0
,
(
struct
sockaddr_in6
*
)
&
RTC
::
UDPSocket
::
sockaddrStorageIPv6
);
if
(
err
)
MS_ABORT
(
"uv_ipv6_addr() failed: %s"
,
uv_strerror
(
err
));
}
UDPSocket
::
minPort
=
Settings
::
configuration
.
RTC
.
m
inPort
;
UDPSocket
::
maxPort
=
Settings
::
configuration
.
RTC
.
m
axPort
;
UDPSocket
::
minPort
=
Settings
::
configuration
.
rtcM
inPort
;
UDPSocket
::
maxPort
=
Settings
::
configuration
.
rtcM
axPort
;
MS_PORT
i
=
RTC
::
UDPSocket
::
minPort
;
do
...
...
@@ -98,9 +98,9 @@ namespace RTC
{
MS_TRACE
();
if
(
address_family
==
AF_INET
&&
!
Settings
::
configuration
.
RTC
.
hasIPv4
)
if
(
address_family
==
AF_INET
&&
!
Settings
::
configuration
.
hasIPv4
)
MS_THROW_ERROR
(
"IPv4 family not available for RTC"
);
else
if
(
address_family
==
AF_INET6
&&
!
Settings
::
configuration
.
RTC
.
hasIPv6
)
else
if
(
address_family
==
AF_INET6
&&
!
Settings
::
configuration
.
hasIPv6
)
MS_THROW_ERROR
(
"IPv6 family not available for RTC"
);
int
err
;
...
...
@@ -121,14 +121,14 @@ namespace RTC
available_ports
=
&
RTC
::
UDPSocket
::
availableIPv4Ports
;
first_bind_addr
=
RTC
::
UDPSocket
::
sockaddrStorageIPv4
;
second_bind_addr
=
RTC
::
UDPSocket
::
sockaddrStorageIPv4
;
listenIP
=
Settings
::
configuration
.
RTC
.
l
istenIPv4
.
c_str
();
listenIP
=
Settings
::
configuration
.
rtcL
istenIPv4
.
c_str
();
break
;
case
AF_INET6
:
available_ports
=
&
RTC
::
UDPSocket
::
availableIPv6Ports
;
first_bind_addr
=
RTC
::
UDPSocket
::
sockaddrStorageIPv6
;
second_bind_addr
=
RTC
::
UDPSocket
::
sockaddrStorageIPv6
;
listenIP
=
Settings
::
configuration
.
RTC
.
l
istenIPv6
.
c_str
();
listenIP
=
Settings
::
configuration
.
rtcL
istenIPv6
.
c_str
();
// Don't also bind into IPv4 when listening in IPv6.
flags
|=
UV_UDP_IPV6ONLY
;
break
;
...
...
worker/src/Settings.cpp
浏览文件 @
aa587a71
差异被折叠。
点击展开。
worker/src/handles/TCPConnection.cpp
浏览文件 @
aa587a71
...
...
@@ -154,7 +154,7 @@ void TCPConnection::Write(const MS_BYTE* data, size_t len)
// Error. Should not happen.
else
if
(
written
<
0
)
{
MS_
NOTICE
(
"uv_try_write() failed: %s | closing the connection"
,
uv_strerror
(
written
));
MS_
WARN
(
"uv_try_write() failed: %s | closing the connection"
,
uv_strerror
(
written
));
Close
();
return
;
}
...
...
@@ -216,7 +216,7 @@ void TCPConnection::Write(const MS_BYTE* data1, size_t len1, const MS_BYTE* data
// Error. Should not happen.
else
if
(
written
<
0
)
{
MS_
NOTICE
(
"uv_try_write() failed: %s | closing the connection"
,
uv_strerror
(
written
));
MS_
WARN
(
"uv_try_write() failed: %s | closing the connection"
,
uv_strerror
(
written
));
Close
();
return
;
}
...
...
@@ -366,7 +366,7 @@ void TCPConnection::onUvRead(ssize_t nread, const uv_buf_t* buf)
// Some error.
else
{
MS_
NOTICE
(
"read error: %s | closing the connection"
,
uv_strerror
(
nread
));
MS_
INFO
(
"read error: %s | closing the connection"
,
uv_strerror
(
nread
));
this
->
hasError
=
true
;
// Close server side of the connection.
...
...
@@ -389,7 +389,7 @@ void TCPConnection::onUvWriteError(int error)
}
else
{
MS_
NOTICE
(
"write error: %s | closing the connection"
,
uv_strerror
(
error
));
MS_
INFO
(
"write error: %s | closing the connection"
,
uv_strerror
(
error
));
this
->
hasError
=
true
;
}
...
...
@@ -406,7 +406,7 @@ void TCPConnection::onUvShutdown(uv_shutdown_t* req, int status)
if
(
status
==
UV_EPIPE
||
status
==
UV_ENOTCONN
||
status
==
UV_ECANCELED
)
MS_DEBUG
(
"shutdown error: %s"
,
uv_strerror
(
status
));
else
if
(
status
)
MS_
NOTICE
(
"shutdown error: %s"
,
uv_strerror
(
status
));
MS_
INFO
(
"shutdown error: %s"
,
uv_strerror
(
status
));
// Now do close the handle.
uv_close
((
uv_handle_t
*
)
this
->
uvHandle
,
(
uv_close_cb
)
on_close
);
...
...
worker/src/handles/UDPSocket.cpp
浏览文件 @
aa587a71
...
...
@@ -192,7 +192,7 @@ void UDPSocket::Send(const MS_BYTE* data, size_t len, const struct sockaddr* add
// Error,
else
if
(
sent
!=
UV_EAGAIN
)
{
MS_
ERROR
(
"uv_udp_try_send() failed: %s"
,
uv_strerror
(
sent
));
MS_
WARN
(
"uv_udp_try_send() failed: %s"
,
uv_strerror
(
sent
));
return
;
}
// Otherwise UV_EAGAIN was returned so cannot send data at first time. Use uv_udp_send().
...
...
@@ -214,7 +214,7 @@ void UDPSocket::Send(const MS_BYTE* data, size_t len, const struct sockaddr* add
{
// NOTE: uv_udp_send() returns error if a wrong INET family is given
// (IPv6 destination on a IPv4 binded socket), so be ready.
MS_
ERROR
(
"uv_udp_send() failed: %s"
,
uv_strerror
(
err
));
MS_
WARN
(
"uv_udp_send() failed: %s"
,
uv_strerror
(
err
));
// Delete the UvSendData struct (which includes the uv_req_t and the store char[]).
std
::
free
(
send_data
);
...
...
@@ -344,7 +344,7 @@ void UDPSocket::onUvRecv(ssize_t nread, const uv_buf_t* buf, const struct sockad
// Some error.
else
{
MS_
NOTICE
(
"read error: %s"
,
uv_strerror
(
nread
));
MS_
INFO
(
"read error: %s"
,
uv_strerror
(
nread
));
}
}
...
...
@@ -356,7 +356,7 @@ void UDPSocket::onUvSendError(int error)
if
(
this
->
isClosing
)
return
;
MS_
NOTICE
(
"send error: %s"
,
uv_strerror
(
error
));
MS_
INFO
(
"send error: %s"
,
uv_strerror
(
error
));
}
inline
...
...
worker/src/handles/UnixStreamSocket.cpp
浏览文件 @
aa587a71
...
...
@@ -144,7 +144,7 @@ void UnixStreamSocket::Write(const MS_BYTE* data, size_t len)
// Error. Should not happen.
else
if
(
written
<
0
)
{
MS_
NOTICE
(
"uv_try_write() failed: %s | closing the connection"
,
uv_strerror
(
written
));
MS_
WARN
(
"uv_try_write() failed: %s | closing the connection"
,
uv_strerror
(
written
));
Close
();
return
;
}
...
...
@@ -257,7 +257,7 @@ void UnixStreamSocket::onUvRead(ssize_t nread, const uv_buf_t* buf)
// Some error.
else
{
MS_
NOTICE
(
"read error: %s | closing the pipe"
,
uv_strerror
(
nread
));
MS_
INFO
(
"read error: %s | closing the pipe"
,
uv_strerror
(
nread
));
this
->
hasError
=
true
;
// Close the socket.
...
...
@@ -280,7 +280,7 @@ void UnixStreamSocket::onUvWriteError(int error)
}
else
{
MS_
NOTICE
(
"write error: %s | closing the pipe"
,
uv_strerror
(
error
));
MS_
INFO
(
"write error: %s | closing the pipe"
,
uv_strerror
(
error
));
this
->
hasError
=
true
;
}
...
...
@@ -297,7 +297,7 @@ void UnixStreamSocket::onUvShutdown(uv_shutdown_t* req, int status)
if
(
status
==
UV_EPIPE
||
status
==
UV_ENOTCONN
||
status
==
UV_ECANCELED
)
MS_DEBUG
(
"shutdown error: %s"
,
uv_strerror
(
status
));
else
if
(
status
)
MS_
NOTICE
(
"shutdown error: %s"
,
uv_strerror
(
status
));
MS_
INFO
(
"shutdown error: %s"
,
uv_strerror
(
status
));
// Now do close the handle.
uv_close
((
uv_handle_t
*
)
this
->
uvHandle
,
(
uv_close_cb
)
on_close
);
...
...
worker/src/main.cpp
浏览文件 @
aa587a71
...
...
@@ -24,8 +24,14 @@ static void init();
static
void
ignoreSignals
();
static
void
destroy
();
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[]
,
char
**
envp
)
{
char
**
env
;
for
(
env
=
envp
;
*
env
!=
0
;
env
++
)
{
// printf("%s\n", *env);
}
std
::
string
id
;
if
(
argc
==
1
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论