Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
89d793c7
提交
89d793c7
authored
12月 21, 2015
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve syntax
上级
7d62fea1
显示空白字符变更
内嵌
并排
正在显示
40 个修改的文件
包含
113 行增加
和
97 行删除
+113
-97
index.js
lib/Channel/index.js
+2
-1
Request.h
worker/include/Channel/Request.h
+2
-2
UnixStreamSocket.h
worker/include/Channel/UnixStreamSocket.h
+2
-2
Loop.h
worker/include/Loop.h
+5
-1
DTLSHandler.h
worker/include/RTC/DTLSHandler.h
+4
-4
FingerprintHash.h
worker/include/RTC/FingerprintHash.h
+1
-1
ICEServer.h
worker/include/RTC/ICEServer.h
+3
-3
Peer.h
worker/include/RTC/Peer.h
+4
-4
RTCPPacket.h
worker/include/RTC/RTCPPacket.h
+2
-2
RTPPacket.h
worker/include/RTC/RTPPacket.h
+3
-3
Room.h
worker/include/RTC/Room.h
+3
-3
SRTPProfile.h
worker/include/RTC/SRTPProfile.h
+1
-1
SRTPSession.h
worker/include/RTC/SRTPSession.h
+2
-2
STUNMessage.h
worker/include/RTC/STUNMessage.h
+3
-3
Stream.h
worker/include/RTC/Stream.h
+1
-1
TCPConnection.h
worker/include/RTC/TCPConnection.h
+3
-3
TCPServer.h
worker/include/RTC/TCPServer.h
+2
-2
Transport.h
worker/include/RTC/Transport.h
+4
-4
TransportSource.h
worker/include/RTC/TransportSource.h
+3
-3
UDPSocket.h
worker/include/RTC/UDPSocket.h
+2
-2
SignalsHandler.h
worker/include/handles/SignalsHandler.h
+2
-2
TCPConnection.h
worker/include/handles/TCPConnection.h
+2
-2
TCPServer.h
worker/include/handles/TCPServer.h
+3
-3
Timer.h
worker/include/handles/Timer.h
+2
-2
UDPSocket.h
worker/include/handles/UDPSocket.h
+3
-3
UnixStreamSocket.h
worker/include/handles/UnixStreamSocket.h
+3
-3
UnixStreamSocket.cpp
worker/src/Channel/UnixStreamSocket.cpp
+15
-11
Loop.cpp
worker/src/Loop.cpp
+9
-1
ICEServer.cpp
worker/src/RTC/ICEServer.cpp
+1
-1
RTCPPacket.cpp
worker/src/RTC/RTCPPacket.cpp
+1
-1
RTPPacket.cpp
worker/src/RTC/RTPPacket.cpp
+1
-1
Room.cpp
worker/src/RTC/Room.cpp
+10
-10
SRTPSession.cpp
worker/src/RTC/SRTPSession.cpp
+1
-1
STUNMessage.cpp
worker/src/RTC/STUNMessage.cpp
+1
-1
Stream.cpp
worker/src/RTC/Stream.cpp
+1
-2
TCPConnection.cpp
worker/src/RTC/TCPConnection.cpp
+2
-2
TCPServer.cpp
worker/src/RTC/TCPServer.cpp
+1
-1
Transport.cpp
worker/src/RTC/Transport.cpp
+1
-1
TransportSource.cpp
worker/src/RTC/TransportSource.cpp
+1
-1
UDPSocket.cpp
worker/src/RTC/UDPSocket.cpp
+1
-1
没有找到文件。
lib/Channel/index.js
浏览文件 @
89d793c7
...
@@ -6,8 +6,9 @@ const netstring = require('netstring');
...
@@ -6,8 +6,9 @@ const netstring = require('netstring');
const
logger
=
require
(
'../logger'
)(
'Channel'
);
const
logger
=
require
(
'../logger'
)(
'Channel'
);
const
Request
=
require
(
'./Request'
);
const
Request
=
require
(
'./Request'
);
// netstring length for a 65536 bytes payload
const
MESSAGE_MAX_SIZE
=
65543
;
// Max time waiting for a response from the worker subprocess
// Max time waiting for a response from the worker subprocess
const
MESSAGE_MAX_SIZE
=
65536
;
const
REQUEST_TIMEOUT
=
5000
;
const
REQUEST_TIMEOUT
=
5000
;
class
Channel
extends
EventEmitter
class
Channel
extends
EventEmitter
...
...
worker/include/Channel/Request.h
浏览文件 @
89d793c7
...
@@ -26,12 +26,12 @@ namespace Channel
...
@@ -26,12 +26,12 @@ namespace Channel
void
Reject
(
unsigned
int
status
,
const
char
*
reason
=
nullptr
);
void
Reject
(
unsigned
int
status
,
const
char
*
reason
=
nullptr
);
public
:
public
:
// Passed by argument
:
// Passed by argument
.
Channel
::
UnixStreamSocket
*
channel
=
nullptr
;
Channel
::
UnixStreamSocket
*
channel
=
nullptr
;
unsigned
int
id
;
unsigned
int
id
;
std
::
string
method
;
std
::
string
method
;
Json
::
Value
data
;
Json
::
Value
data
;
// Others
:
// Others
.
bool
replied
=
false
;
bool
replied
=
false
;
};
};
}
}
...
...
worker/include/Channel/UnixStreamSocket.h
浏览文件 @
89d793c7
...
@@ -36,9 +36,9 @@ namespace Channel
...
@@ -36,9 +36,9 @@ namespace Channel
virtual
void
userOnUnixStreamSocketClosed
(
bool
is_closed_by_peer
)
override
;
virtual
void
userOnUnixStreamSocketClosed
(
bool
is_closed_by_peer
)
override
;
private
:
private
:
// Passed by argument
:
// Passed by argument
.
Listener
*
listener
=
nullptr
;
Listener
*
listener
=
nullptr
;
// Others
:
// Others
.
size_t
msgStart
=
0
;
// Where the latest message starts.
size_t
msgStart
=
0
;
// Where the latest message starts.
};
};
}
}
...
...
worker/include/Loop.h
浏览文件 @
89d793c7
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
#include "handles/SignalsHandler.h"
#include "handles/SignalsHandler.h"
#include "Channel/UnixStreamSocket.h"
#include "Channel/UnixStreamSocket.h"
#include "Channel/Request.h"
#include "Channel/Request.h"
#include "RTC/Room.h"
#include <unordered_map>
class
Loop
:
class
Loop
:
public
SignalsHandler
::
Listener
,
public
SignalsHandler
::
Listener
,
...
@@ -14,7 +16,7 @@ public:
...
@@ -14,7 +16,7 @@ public:
Loop
();
Loop
();
~
Loop
();
~
Loop
();
// TODO: IMHO this can be private.
private
:
void
Close
();
void
Close
();
/* Methods inherited from SignalsHandler::Listener. */
/* Methods inherited from SignalsHandler::Listener. */
...
@@ -33,6 +35,8 @@ private:
...
@@ -33,6 +35,8 @@ private:
Channel
::
UnixStreamSocket
*
channel
=
nullptr
;
Channel
::
UnixStreamSocket
*
channel
=
nullptr
;
// Others.
// Others.
bool
closed
=
false
;
bool
closed
=
false
;
typedef
std
::
unordered_map
<
unsigned
int
,
RTC
::
Room
*>
Rooms
;
Rooms
rooms
;
};
};
#endif
#endif
worker/include/RTC/DTLSHandler.h
浏览文件 @
89d793c7
...
@@ -94,14 +94,14 @@ namespace RTC
...
@@ -94,14 +94,14 @@ namespace RTC
virtual
void
onTimer
(
Timer
*
timer
)
override
;
virtual
void
onTimer
(
Timer
*
timer
)
override
;
private
:
private
:
// Passed by argument
:
// Passed by argument
.
Listener
*
listener
=
nullptr
;
Listener
*
listener
=
nullptr
;
// Allocated by this
:
// Allocated by this
.
SSL
*
ssl
=
nullptr
;
SSL
*
ssl
=
nullptr
;
BIO
*
sslBioFromNetwork
=
nullptr
;
// The BIO from which ssl reads.
BIO
*
sslBioFromNetwork
=
nullptr
;
// The BIO from which ssl reads.
BIO
*
sslBioToNetwork
=
nullptr
;
// The BIO in which ssl writes.
BIO
*
sslBioToNetwork
=
nullptr
;
// The BIO in which ssl writes.
Timer
*
timer
=
nullptr
;
Timer
*
timer
=
nullptr
;
// Others
:
// Others
.
RTC
::
DTLSRole
role
;
RTC
::
DTLSRole
role
;
RTC
::
FingerprintHash
remoteFingerprintHash
=
RTC
::
FingerprintHash
::
NONE
;
RTC
::
FingerprintHash
remoteFingerprintHash
=
RTC
::
FingerprintHash
::
NONE
;
std
::
string
remoteFingerprint
;
std
::
string
remoteFingerprint
;
...
@@ -140,6 +140,6 @@ namespace RTC
...
@@ -140,6 +140,6 @@ namespace RTC
{
{
return
this
->
isRunning
;
return
this
->
isRunning
;
}
}
}
// namespace RTC
}
#endif
#endif
worker/include/RTC/FingerprintHash.h
浏览文件 @
89d793c7
...
@@ -12,6 +12,6 @@ namespace RTC
...
@@ -12,6 +12,6 @@ namespace RTC
SHA384
,
SHA384
,
SHA512
SHA512
};
};
}
// namespace RTC
}
#endif
#endif
worker/include/RTC/ICEServer.h
浏览文件 @
89d793c7
...
@@ -35,10 +35,10 @@ namespace RTC
...
@@ -35,10 +35,10 @@ namespace RTC
void
Close
();
void
Close
();
private
:
private
:
// Passed by argument
:
// Passed by argument
.
Listener
*
listener
=
nullptr
;
Listener
*
listener
=
nullptr
;
void
*
userData
=
nullptr
;
void
*
userData
=
nullptr
;
// Others
:
// Others
.
std
::
string
localUsername
;
std
::
string
localUsername
;
std
::
string
localPassword
;
std
::
string
localPassword
;
};
};
...
@@ -68,6 +68,6 @@ namespace RTC
...
@@ -68,6 +68,6 @@ namespace RTC
{
{
return
this
->
userData
;
return
this
->
userData
;
}
}
}
// namespace RTC
}
#endif
#endif
worker/include/RTC/Peer.h
浏览文件 @
89d793c7
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
namespace
RTC
namespace
RTC
{
{
class
Peer
:
RTC
::
Transport
::
Listener
class
Peer
:
public
RTC
::
Transport
::
Listener
{
{
public
:
public
:
class
Listener
class
Listener
...
@@ -34,10 +34,10 @@ namespace RTC
...
@@ -34,10 +34,10 @@ namespace RTC
virtual
void
onRTCPPacket
(
RTC
::
Transport
*
transport
,
RTC
::
RTCPPacket
*
packet
)
override
;
virtual
void
onRTCPPacket
(
RTC
::
Transport
*
transport
,
RTC
::
RTCPPacket
*
packet
)
override
;
private
:
private
:
// Passed by argument
:
// Passed by argument
.
Listener
*
listener
=
nullptr
;
Listener
*
listener
=
nullptr
;
void
*
userData
=
nullptr
;
void
*
userData
=
nullptr
;
// Others
:
// Others
.
RTC
::
Transport
*
transport
=
nullptr
;
RTC
::
Transport
*
transport
=
nullptr
;
};
};
...
@@ -54,6 +54,6 @@ namespace RTC
...
@@ -54,6 +54,6 @@ namespace RTC
{
{
return
this
->
userData
;
return
this
->
userData
;
}
}
}
// namespace RTC
}
#endif
#endif
worker/include/RTC/RTCPPacket.h
浏览文件 @
89d793c7
...
@@ -36,7 +36,7 @@ namespace RTC
...
@@ -36,7 +36,7 @@ namespace RTC
size_t
GetLength
();
size_t
GetLength
();
private
:
private
:
// Passed by argument
:
// Passed by argument
.
CommonHeader
*
header
=
nullptr
;
CommonHeader
*
header
=
nullptr
;
MS_BYTE
*
raw
=
nullptr
;
MS_BYTE
*
raw
=
nullptr
;
size_t
length
=
0
;
size_t
length
=
0
;
...
@@ -75,6 +75,6 @@ namespace RTC
...
@@ -75,6 +75,6 @@ namespace RTC
{
{
return
this
->
length
;
return
this
->
length
;
}
}
}
// namespace RTC
}
#endif
#endif
worker/include/RTC/RTPPacket.h
浏览文件 @
89d793c7
...
@@ -66,7 +66,7 @@ namespace RTC
...
@@ -66,7 +66,7 @@ namespace RTC
void
Dump
();
void
Dump
();
private
:
private
:
// Passed by argument
:
// Passed by argument
.
Header
*
header
=
nullptr
;
Header
*
header
=
nullptr
;
MS_BYTE
*
csrcList
=
nullptr
;
MS_BYTE
*
csrcList
=
nullptr
;
ExtensionHeader
*
extensionHeader
=
nullptr
;
ExtensionHeader
*
extensionHeader
=
nullptr
;
...
@@ -75,7 +75,7 @@ namespace RTC
...
@@ -75,7 +75,7 @@ namespace RTC
MS_BYTE
payloadPadding
=
0
;
MS_BYTE
payloadPadding
=
0
;
MS_BYTE
*
raw
=
nullptr
;
// Allocated when Serialize().
MS_BYTE
*
raw
=
nullptr
;
// Allocated when Serialize().
size_t
length
=
0
;
size_t
length
=
0
;
// Others
:
// Others
.
bool
isSerialized
=
false
;
bool
isSerialized
=
false
;
};
};
...
@@ -195,6 +195,6 @@ namespace RTC
...
@@ -195,6 +195,6 @@ namespace RTC
{
{
return
this
->
payloadLength
;
return
this
->
payloadLength
;
}
}
}
// namespace RTC
}
#endif
#endif
worker/include/RTC/Room.h
浏览文件 @
89d793c7
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
namespace
RTC
namespace
RTC
{
{
class
Room
:
RTC
::
Peer
::
Listener
class
Room
:
public
RTC
::
Peer
::
Listener
{
{
public
:
public
:
Room
();
Room
();
...
@@ -22,10 +22,10 @@ namespace RTC
...
@@ -22,10 +22,10 @@ namespace RTC
virtual
void
onRTCPPacket
(
RTC
::
Peer
*
peer
,
RTC
::
RTCPPacket
*
packet
)
override
;
virtual
void
onRTCPPacket
(
RTC
::
Peer
*
peer
,
RTC
::
RTCPPacket
*
packet
)
override
;
private
:
private
:
// Others
:
// Others
.
typedef
std
::
vector
<
RTC
::
Peer
*>
Peers
;
typedef
std
::
vector
<
RTC
::
Peer
*>
Peers
;
Peers
peers
;
Peers
peers
;
};
};
}
// namespace RTC
}
#endif
#endif
worker/include/RTC/SRTPProfile.h
浏览文件 @
89d793c7
...
@@ -9,6 +9,6 @@ namespace RTC
...
@@ -9,6 +9,6 @@ namespace RTC
AES_CM_128_HMAC_SHA1_80
=
1
,
AES_CM_128_HMAC_SHA1_80
=
1
,
AES_CM_128_HMAC_SHA1_32
AES_CM_128_HMAC_SHA1_32
};
};
}
// namespace RTC
}
#endif
#endif
worker/include/RTC/SRTPSession.h
浏览文件 @
89d793c7
...
@@ -38,7 +38,7 @@ namespace RTC
...
@@ -38,7 +38,7 @@ namespace RTC
void
Close
();
void
Close
();
private
:
private
:
// Allocated by this
:
// Allocated by this
.
srtp_t
session
=
nullptr
;
srtp_t
session
=
nullptr
;
// Others:
// Others:
err_status_t
lastError
=
(
err_status_t
)
0
;
err_status_t
lastError
=
(
err_status_t
)
0
;
...
@@ -56,6 +56,6 @@ namespace RTC
...
@@ -56,6 +56,6 @@ namespace RTC
return
error_string
;
return
error_string
;
}
}
}
// namespace RTC
}
#endif
#endif
worker/include/RTC/STUNMessage.h
浏览文件 @
89d793c7
...
@@ -93,13 +93,13 @@ namespace RTC
...
@@ -93,13 +93,13 @@ namespace RTC
void
Dump
();
void
Dump
();
private
:
private
:
// Passed by argument
:
// Passed by argument
.
Class
klass
;
// 2 bytes.
Class
klass
;
// 2 bytes.
Method
method
;
// 2 bytes.
Method
method
;
// 2 bytes.
const
MS_BYTE
*
transactionId
=
nullptr
;
// 12 bytes.
const
MS_BYTE
*
transactionId
=
nullptr
;
// 12 bytes.
MS_BYTE
*
raw
=
nullptr
;
// Allocated when Serialize().
MS_BYTE
*
raw
=
nullptr
;
// Allocated when Serialize().
size_t
length
=
0
;
// The full message size (including header).
size_t
length
=
0
;
// The full message size (including header).
// Others
:
// Others
.
bool
isSerialized
=
false
;
bool
isSerialized
=
false
;
// STUN attributes.
// STUN attributes.
std
::
string
username
;
// Less than 513 bytes.
std
::
string
username
;
// Less than 513 bytes.
...
@@ -269,6 +269,6 @@ namespace RTC
...
@@ -269,6 +269,6 @@ namespace RTC
{
{
return
this
->
hasFingerprint
;
return
this
->
hasFingerprint
;
}
}
}
// namespace RTC
}
#endif
#endif
worker/include/RTC/Stream.h
浏览文件 @
89d793c7
...
@@ -20,6 +20,6 @@ namespace RTC
...
@@ -20,6 +20,6 @@ namespace RTC
MS_4BYTES
ssrc
=
0
;
MS_4BYTES
ssrc
=
0
;
std
::
unordered_set
<
MS_BYTE
>
payloads
;
std
::
unordered_set
<
MS_BYTE
>
payloads
;
};
};
}
// namespace RTC
}
#endif
#endif
worker/include/RTC/TCPConnection.h
浏览文件 @
89d793c7
...
@@ -29,11 +29,11 @@ namespace RTC
...
@@ -29,11 +29,11 @@ namespace RTC
virtual
void
userOnTCPConnectionRead
()
override
;
virtual
void
userOnTCPConnectionRead
()
override
;
private
:
private
:
// Passed by argument
:
// Passed by argument
.
Reader
*
reader
=
nullptr
;
Reader
*
reader
=
nullptr
;
// Others
:
// Others
.
size_t
frameStart
=
0
;
// Where the latest frame starts.
size_t
frameStart
=
0
;
// Where the latest frame starts.
};
};
}
// namespace RTC
}
#endif
#endif
worker/include/RTC/TCPServer.h
浏览文件 @
89d793c7
...
@@ -49,7 +49,7 @@ namespace RTC
...
@@ -49,7 +49,7 @@ namespace RTC
virtual
void
userOnTCPServerClosed
()
override
;
virtual
void
userOnTCPServerClosed
()
override
;
private
:
private
:
// Passed by argument
:
// Passed by argument
.
Listener
*
listener
=
nullptr
;
Listener
*
listener
=
nullptr
;
RTC
::
TCPConnection
::
Reader
*
reader
=
nullptr
;
RTC
::
TCPConnection
::
Reader
*
reader
=
nullptr
;
};
};
...
@@ -62,6 +62,6 @@ namespace RTC
...
@@ -62,6 +62,6 @@ namespace RTC
this
->
listener
=
listener
;
this
->
listener
=
listener
;
this
->
reader
=
reader
;
this
->
reader
=
reader
;
}
}
}
// namespace RTC
}
#endif
#endif
worker/include/RTC/Transport.h
浏览文件 @
89d793c7
...
@@ -141,17 +141,17 @@ namespace RTC
...
@@ -141,17 +141,17 @@ namespace RTC
virtual
void
onDTLSApplicationData
(
RTC
::
DTLSHandler
*
dtlsHandler
,
const
MS_BYTE
*
data
,
size_t
len
)
override
;
virtual
void
onDTLSApplicationData
(
RTC
::
DTLSHandler
*
dtlsHandler
,
const
MS_BYTE
*
data
,
size_t
len
)
override
;
private
:
private
:
// Allocated by this
:
// Allocated by this
.
RTC
::
ICEServer
*
iceServer
=
nullptr
;
RTC
::
ICEServer
*
iceServer
=
nullptr
;
RTC
::
DTLSHandler
*
dtlsHandler
=
nullptr
;
RTC
::
DTLSHandler
*
dtlsHandler
=
nullptr
;
RTC
::
SRTPSession
*
srtpRecvSession
=
nullptr
;
RTC
::
SRTPSession
*
srtpRecvSession
=
nullptr
;
RTC
::
SRTPSession
*
srtpSendSession
=
nullptr
;
RTC
::
SRTPSession
*
srtpSendSession
=
nullptr
;
// Passed by argument
:
// Passed by argument
.
Listener
*
listener
=
nullptr
;
Listener
*
listener
=
nullptr
;
std
::
vector
<
RTC
::
UDPSocket
*>
udpSockets
;
std
::
vector
<
RTC
::
UDPSocket
*>
udpSockets
;
std
::
vector
<
RTC
::
TCPServer
*>
tcpServers
;
std
::
vector
<
RTC
::
TCPServer
*>
tcpServers
;
void
*
userData
=
nullptr
;
void
*
userData
=
nullptr
;
// Others
:
// Others
.
int
flags
=
0
;
int
flags
=
0
;
std
::
list
<
RTC
::
TransportSource
>
sources
;
std
::
list
<
RTC
::
TransportSource
>
sources
;
RTC
::
TransportSource
*
sendingSource
=
nullptr
;
RTC
::
TransportSource
*
sendingSource
=
nullptr
;
...
@@ -326,6 +326,6 @@ namespace RTC
...
@@ -326,6 +326,6 @@ namespace RTC
return
false
;
return
false
;
}
}
}
// namespace RTC
}
#endif
#endif
worker/include/RTC/TransportSource.h
浏览文件 @
89d793c7
...
@@ -32,12 +32,12 @@ namespace RTC
...
@@ -32,12 +32,12 @@ namespace RTC
void
Dump
();
void
Dump
();
private
:
private
:
// Passed by argument
:
// Passed by argument
.
RTC
::
UDPSocket
*
udpSocket
=
nullptr
;
RTC
::
UDPSocket
*
udpSocket
=
nullptr
;
struct
sockaddr
*
udpRemoteAddr
=
nullptr
;
struct
sockaddr
*
udpRemoteAddr
=
nullptr
;
sockaddr_storage
udpRemoteAddrStorage
;
sockaddr_storage
udpRemoteAddrStorage
;
RTC
::
TCPConnection
*
tcpConnection
=
nullptr
;
RTC
::
TCPConnection
*
tcpConnection
=
nullptr
;
// Others
:
// Others
.
Type
type
;
Type
type
;
};
};
...
@@ -118,6 +118,6 @@ namespace RTC
...
@@ -118,6 +118,6 @@ namespace RTC
if
(
this
->
type
==
Type
::
TCP
)
if
(
this
->
type
==
Type
::
TCP
)
this
->
tcpConnection
->
Close
();
this
->
tcpConnection
->
Close
();
}
}
}
// namespace RTC
}
#endif
#endif
worker/include/RTC/UDPSocket.h
浏览文件 @
89d793c7
...
@@ -49,7 +49,7 @@ namespace RTC
...
@@ -49,7 +49,7 @@ namespace RTC
virtual
void
userOnUDPSocketClosed
()
override
;
virtual
void
userOnUDPSocketClosed
()
override
;
private
:
private
:
// Passed by argument
:
// Passed by argument
.
Listener
*
listener
=
nullptr
;
Listener
*
listener
=
nullptr
;
};
};
...
@@ -60,6 +60,6 @@ namespace RTC
...
@@ -60,6 +60,6 @@ namespace RTC
{
{
this
->
listener
=
listener
;
this
->
listener
=
listener
;
}
}
}
// namespace RTC
}
#endif
#endif
worker/include/handles/SignalsHandler.h
浏览文件 @
89d793c7
...
@@ -26,10 +26,10 @@ public:
...
@@ -26,10 +26,10 @@ public:
void
onUvSignal
(
int
signum
);
void
onUvSignal
(
int
signum
);
private
:
private
:
// Allocated by this
:
// Allocated by this
.
typedef
std
::
vector
<
uv_signal_t
*>
UvHandles
;
typedef
std
::
vector
<
uv_signal_t
*>
UvHandles
;
UvHandles
uvHandles
;
UvHandles
uvHandles
;
// Passed by argument
:
// Passed by argument
.
Listener
*
listener
=
nullptr
;
Listener
*
listener
=
nullptr
;
};
};
...
...
worker/include/handles/TCPConnection.h
浏览文件 @
89d793c7
...
@@ -70,9 +70,9 @@ private:
...
@@ -70,9 +70,9 @@ private:
bool
hasError
=
false
;
bool
hasError
=
false
;
protected
:
protected
:
// Allocated by this
:
// Allocated by this
.
MS_BYTE
*
buffer
=
nullptr
;
MS_BYTE
*
buffer
=
nullptr
;
// Passed by argument
:
// Passed by argument
.
size_t
bufferSize
=
0
;
size_t
bufferSize
=
0
;
// Others.
// Others.
size_t
bufferDataLen
=
0
;
size_t
bufferDataLen
=
0
;
...
...
worker/include/handles/TCPServer.h
浏览文件 @
89d793c7
...
@@ -47,11 +47,11 @@ public:
...
@@ -47,11 +47,11 @@ public:
virtual
void
onTCPConnectionClosed
(
TCPConnection
*
connection
,
bool
is_closed_by_peer
);
virtual
void
onTCPConnectionClosed
(
TCPConnection
*
connection
,
bool
is_closed_by_peer
);
private
:
private
:
// Allocated by this (may be passed by argument)
:
// Allocated by this (may be passed by argument)
.
uv_tcp_t
*
uvHandle
=
nullptr
;
uv_tcp_t
*
uvHandle
=
nullptr
;
// Passed by argument
:
// Passed by argument
.
void
*
userData
=
nullptr
;
void
*
userData
=
nullptr
;
// Others
:
// Others
.
typedef
std
::
unordered_set
<
TCPConnection
*>
TCPConnections
;
typedef
std
::
unordered_set
<
TCPConnection
*>
TCPConnections
;
TCPConnections
connections
;
TCPConnections
connections
;
bool
isClosing
=
false
;
bool
isClosing
=
false
;
...
...
worker/include/handles/Timer.h
浏览文件 @
89d793c7
...
@@ -25,9 +25,9 @@ public:
...
@@ -25,9 +25,9 @@ public:
void
onUvTimer
();
void
onUvTimer
();
private
:
private
:
// Allocated by this
:
// Allocated by this
.
uv_timer_t
*
uvHandle
=
nullptr
;
uv_timer_t
*
uvHandle
=
nullptr
;
// Passed by argument
:
// Passed by argument
.
Listener
*
listener
=
nullptr
;
Listener
*
listener
=
nullptr
;
};
};
...
...
worker/include/handles/UDPSocket.h
浏览文件 @
89d793c7
...
@@ -55,11 +55,11 @@ protected:
...
@@ -55,11 +55,11 @@ protected:
virtual
void
userOnUDPSocketClosed
()
=
0
;
virtual
void
userOnUDPSocketClosed
()
=
0
;
private
:
private
:
// Allocated by this (may be passed by argument)
:
// Allocated by this (may be passed by argument)
.
uv_udp_t
*
uvHandle
=
nullptr
;
uv_udp_t
*
uvHandle
=
nullptr
;
// Passed by argument
:
// Passed by argument
.
void
*
userData
=
nullptr
;
void
*
userData
=
nullptr
;
// Others
:
// Others
.
bool
isClosing
=
false
;
bool
isClosing
=
false
;
protected
:
protected
:
...
...
worker/include/handles/UnixStreamSocket.h
浏览文件 @
89d793c7
...
@@ -51,11 +51,11 @@ private:
...
@@ -51,11 +51,11 @@ private:
bool
hasError
=
false
;
bool
hasError
=
false
;
protected
:
protected
:
// Allocated by this
:
// Allocated by this
.
MS_BYTE
*
buffer
=
nullptr
;
MS_BYTE
*
buffer
=
nullptr
;
// Passed by argument
:
// Passed by argument
.
size_t
bufferSize
=
0
;
size_t
bufferSize
=
0
;
// Others
:
// Others
.
size_t
bufferDataLen
=
0
;
size_t
bufferDataLen
=
0
;
};
};
...
...
worker/src/Channel/UnixStreamSocket.cpp
浏览文件 @
89d793c7
...
@@ -8,7 +8,8 @@
...
@@ -8,7 +8,8 @@
#include <cmath> // std::ceil()
#include <cmath> // std::ceil()
#include <cstdio> // sprintf()
#include <cstdio> // sprintf()
#define MESSAGE_MAX_SIZE 65536
// netstring length for a 65536 bytes payload
#define MESSAGE_MAX_SIZE 65543
namespace
Channel
namespace
Channel
{
{
...
@@ -23,6 +24,8 @@ namespace Channel
...
@@ -23,6 +24,8 @@ namespace Channel
listener
(
listener
)
listener
(
listener
)
{
{
MS_TRACE
();
MS_TRACE
();
MS_ERROR
(
"---- MAX NS: %lu"
,
netstring_buffer_size
(
MESSAGE_MAX_SIZE
));
}
}
UnixStreamSocket
::~
UnixStreamSocket
()
UnixStreamSocket
::~
UnixStreamSocket
()
...
@@ -115,23 +118,23 @@ namespace Channel
...
@@ -115,23 +118,23 @@ namespace Channel
return
;
return
;
case
NETSTRING_ERROR_TOO_LONG
:
case
NETSTRING_ERROR_TOO_LONG
:
MS_
THROW_
ERROR
(
"NETSTRING_ERROR_TOO_LONG"
);
MS_ERROR
(
"NETSTRING_ERROR_TOO_LONG"
);
break
;
break
;
case
NETSTRING_ERROR_NO_COLON
:
case
NETSTRING_ERROR_NO_COLON
:
MS_
THROW_
ERROR
(
"NETSTRING_ERROR_NO_COLON"
);
MS_ERROR
(
"NETSTRING_ERROR_NO_COLON"
);
break
;
break
;
case
NETSTRING_ERROR_NO_COMMA
:
case
NETSTRING_ERROR_NO_COMMA
:
MS_
THROW_
ERROR
(
"NETSTRING_ERROR_NO_COMMA"
);
MS_ERROR
(
"NETSTRING_ERROR_NO_COMMA"
);
break
;
break
;
case
NETSTRING_ERROR_LEADING_ZERO
:
case
NETSTRING_ERROR_LEADING_ZERO
:
MS_
THROW_
ERROR
(
"NETSTRING_ERROR_LEADING_ZERO"
);
MS_ERROR
(
"NETSTRING_ERROR_LEADING_ZERO"
);
break
;
break
;
case
NETSTRING_ERROR_NO_LENGTH
:
case
NETSTRING_ERROR_NO_LENGTH
:
MS_
THROW_
ERROR
(
"NETSTRING_ERROR_NO_LENGTH"
);
MS_ERROR
(
"NETSTRING_ERROR_NO_LENGTH"
);
break
;
break
;
}
}
...
@@ -149,11 +152,8 @@ namespace Channel
...
@@ -149,11 +152,8 @@ namespace Channel
Json
::
Value
json
;
Json
::
Value
json
;
Json
::
Reader
reader
;
Json
::
Reader
reader
;
if
(
!
reader
.
parse
((
const
char
*
)
json_start
,
(
const
char
*
)
json_start
+
json_len
,
json
))
if
(
reader
.
parse
((
const
char
*
)
json_start
,
(
const
char
*
)
json_start
+
json_len
,
json
))
{
{
MS_THROW_ERROR
(
"invalid JSON"
);
}
Channel
::
Request
*
request
=
Request
::
Factory
(
this
,
json
);
Channel
::
Request
*
request
=
Request
::
Factory
(
this
,
json
);
if
(
request
)
if
(
request
)
...
@@ -166,9 +166,13 @@ namespace Channel
...
@@ -166,9 +166,13 @@ namespace Channel
}
}
else
else
{
{
// TODO: throw?
MS_ERROR
(
"discarding wrong Channel request"
);
MS_ERROR
(
"discarding wrong Channel request"
);
}
}
}
else
{
MS_ERROR
(
"invalid JSON"
);
}
// If there is no more space available in the buffer and that is because
// If there is no more space available in the buffer and that is because
// the latest parsed message filled it, then empty the full buffer.
// the latest parsed message filled it, then empty the full buffer.
...
...
worker/src/Loop.cpp
浏览文件 @
89d793c7
...
@@ -60,8 +60,16 @@ void Loop::Close()
...
@@ -60,8 +60,16 @@ void Loop::Close()
// Close the SignalsHandler.
// Close the SignalsHandler.
this
->
signalsHandler
->
Close
();
this
->
signalsHandler
->
Close
();
// Close the Channel socket
// Close the Channel socket
.
this
->
channel
->
Close
();
this
->
channel
->
Close
();
// Close all the Rooms.
for
(
auto
&
kv
:
this
->
rooms
)
{
RTC
::
Room
*
room
=
kv
.
second
;
room
->
Close
();
}
}
}
void
Loop
::
onSignal
(
SignalsHandler
*
signalsHandler
,
int
signum
)
void
Loop
::
onSignal
(
SignalsHandler
*
signalsHandler
,
int
signum
)
...
...
worker/src/RTC/ICEServer.cpp
浏览文件 @
89d793c7
...
@@ -185,4 +185,4 @@ namespace RTC
...
@@ -185,4 +185,4 @@ namespace RTC
delete
this
;
delete
this
;
}
}
}
// namespace RTC
}
worker/src/RTC/RTCPPacket.cpp
浏览文件 @
89d793c7
...
@@ -36,4 +36,4 @@ namespace RTC
...
@@ -36,4 +36,4 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
}
}
}
// namespace RTC
}
worker/src/RTC/RTPPacket.cpp
浏览文件 @
89d793c7
...
@@ -233,4 +233,4 @@ namespace RTC
...
@@ -233,4 +233,4 @@ namespace RTC
MS_DEBUG
(
"- Payload size: %zu bytes"
,
GetPayloadLength
());
MS_DEBUG
(
"- Payload size: %zu bytes"
,
GetPayloadLength
());
MS_DEBUG
(
"[/RTPPacket]"
);
MS_DEBUG
(
"[/RTPPacket]"
);
}
}
}
// namespace RTC
}
worker/src/RTC/Room.cpp
浏览文件 @
89d793c7
...
@@ -20,17 +20,16 @@ namespace RTC
...
@@ -20,17 +20,16 @@ namespace RTC
MS_TRACE
();
MS_TRACE
();
// TMP
// TMP
// for (int i = 1; i <= NUM_PEERS; i++)
// {
// RTC::Peer* peer = new RTC::Peer(this);
for
(
int
i
=
1
;
i
<=
NUM_PEERS
;
i
++
)
// // TODO: this is not being freed
{
// int* data = new int(i);
RTC
::
Peer
*
peer
=
new
RTC
::
Peer
(
this
);
// peer->SetUserData((void*)data);
// TODO: this is not being freed
int
*
data
=
new
int
(
i
);
peer
->
SetUserData
((
void
*
)
data
);
this
->
peers
.
push_back
(
peer
);
//
this->peers.push_back(peer);
}
//
}
}
}
Room
::~
Room
()
Room
::~
Room
()
...
@@ -42,6 +41,7 @@ namespace RTC
...
@@ -42,6 +41,7 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
// Close all the Peers.
for
(
auto
peer
:
this
->
peers
)
for
(
auto
peer
:
this
->
peers
)
peer
->
Close
();
peer
->
Close
();
...
@@ -114,4 +114,4 @@ namespace RTC
...
@@ -114,4 +114,4 @@ namespace RTC
// dst_peer->SendRTCPPacket(packet);
// dst_peer->SendRTCPPacket(packet);
// }
// }
}
}
}
// namespace RTC
}
worker/src/RTC/SRTPSession.cpp
浏览文件 @
89d793c7
...
@@ -213,4 +213,4 @@ namespace RTC
...
@@ -213,4 +213,4 @@ namespace RTC
delete
this
;
delete
this
;
}
}
}
// namespace RTC
}
worker/src/RTC/STUNMessage.cpp
浏览文件 @
89d793c7
...
@@ -629,4 +629,4 @@ namespace RTC
...
@@ -629,4 +629,4 @@ namespace RTC
MS_DEBUG
(
"- has Fingerprint"
);
MS_DEBUG
(
"- has Fingerprint"
);
MS_DEBUG
(
"[/STUNMessage]"
);
MS_DEBUG
(
"[/STUNMessage]"
);
}
}
}
// namespace RTC
}
worker/src/RTC/Stream.cpp
浏览文件 @
89d793c7
...
@@ -21,7 +21,6 @@ namespace RTC
...
@@ -21,7 +21,6 @@ namespace RTC
{
{
MS_TRACE
();
MS_TRACE
();
// TODO: sure I want this?
delete
this
;
delete
this
;
}
}
}
// namespace RTC
}
worker/src/RTC/TCPConnection.cpp
浏览文件 @
89d793c7
...
@@ -163,7 +163,7 @@ namespace RTC
...
@@ -163,7 +163,7 @@ namespace RTC
// Exit the parsing loop.
// Exit the parsing loop.
break
;
break
;
}
}
}
// while()
}
}
}
void
TCPConnection
::
Send
(
const
MS_BYTE
*
data
,
size_t
len
)
void
TCPConnection
::
Send
(
const
MS_BYTE
*
data
,
size_t
len
)
...
@@ -178,4 +178,4 @@ namespace RTC
...
@@ -178,4 +178,4 @@ namespace RTC
Write
(
frame_len
,
2
,
data
,
len
);
Write
(
frame_len
,
2
,
data
,
len
);
}
}
}
// namespace RTC
}
worker/src/RTC/TCPServer.cpp
浏览文件 @
89d793c7
...
@@ -365,4 +365,4 @@ namespace RTC
...
@@ -365,4 +365,4 @@ namespace RTC
else
if
(
this
->
localAddr
.
ss_family
==
AF_INET6
)
else
if
(
this
->
localAddr
.
ss_family
==
AF_INET6
)
RTC
::
TCPServer
::
availableIPv6Ports
[
this
->
localPort
]
=
true
;
RTC
::
TCPServer
::
availableIPv6Ports
[
this
->
localPort
]
=
true
;
}
}
}
// namespace RTC
}
worker/src/RTC/Transport.cpp
浏览文件 @
89d793c7
...
@@ -658,4 +658,4 @@ namespace RTC
...
@@ -658,4 +658,4 @@ namespace RTC
// TMP
// TMP
dtlsHandler
->
SendApplicationData
(
data
,
len
);
dtlsHandler
->
SendApplicationData
(
data
,
len
);
}
}
}
// namespace RTC
}
worker/src/RTC/TransportSource.cpp
浏览文件 @
89d793c7
...
@@ -39,4 +39,4 @@ namespace RTC
...
@@ -39,4 +39,4 @@ namespace RTC
}
}
}
}
}
}
}
// namespace RTC
}
worker/src/RTC/UDPSocket.cpp
浏览文件 @
89d793c7
...
@@ -386,4 +386,4 @@ namespace RTC
...
@@ -386,4 +386,4 @@ namespace RTC
else
if
(
this
->
localAddr
.
ss_family
==
AF_INET6
)
else
if
(
this
->
localAddr
.
ss_family
==
AF_INET6
)
RTC
::
UDPSocket
::
availableIPv6Ports
[
this
->
localPort
]
=
true
;
RTC
::
UDPSocket
::
availableIPv6Ports
[
this
->
localPort
]
=
true
;
}
}
}
// namespace RTC
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论