Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
4d84661a
Commit
4d84661a
authored
Apr 23, 2020
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新ZLToolKit
parent
b09919d3
显示空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
35 行增加
和
35 行删除
+35
-35
3rdpart/ZLToolKit
+1
-1
api/source/mk_tcp.cpp
+3
-3
src/Http/HttpClient.cpp
+1
-1
src/Http/HttpSession.cpp
+2
-2
src/Http/WebSocketClient.h
+1
-1
src/Rtmp/RtmpPusher.cpp
+1
-1
src/Rtmp/RtmpSession.cpp
+1
-1
src/Rtsp/RtspPlayer.cpp
+1
-1
src/Rtsp/RtspPusher.cpp
+2
-2
src/Rtsp/RtspSession.cpp
+1
-1
src/Shell/ShellSession.cpp
+18
-18
tests/test_wsClient.cpp
+1
-1
tests/test_wsServer.cpp
+2
-2
没有找到文件。
ZLToolKit
@
fac78b63
Subproject commit f
0608fb75660682150f45f857d5d8051880b13aa
Subproject commit f
ac78b63701ce6febd9ac6acefb637886c651873
api/source/mk_tcp.cpp
查看文件 @
4d84661a
...
...
@@ -46,7 +46,7 @@ API_EXPORT void API_CALL mk_tcp_session_send(const mk_tcp_session ctx,const char
len
=
strlen
(
data
);
}
TcpSession
*
session
=
(
TcpSession
*
)
ctx
;
session
->
send
(
data
,
len
);
session
->
SockSender
::
send
(
data
,
len
);
}
API_EXPORT
void
API_CALL
mk_tcp_session_send_safe
(
const
mk_tcp_session
ctx
,
const
char
*
data
,
int
len
){
...
...
@@ -60,7 +60,7 @@ API_EXPORT void API_CALL mk_tcp_session_send_safe(const mk_tcp_session ctx,const
((
TcpSession
*
)
ctx
)
->
async
([
weak_session
,
str
](){
auto
session_session
=
weak_session
.
lock
();
if
(
session_session
){
session_session
->
send
(
str
);
session_session
->
SockSender
::
send
(
str
);
}
});
}
catch
(
std
::
exception
&
ex
){
...
...
@@ -226,7 +226,7 @@ API_EXPORT void API_CALL mk_tcp_client_connect(mk_tcp_client ctx, const char *ho
API_EXPORT
void
API_CALL
mk_tcp_client_send
(
mk_tcp_client
ctx
,
const
char
*
data
,
int
len
){
assert
(
ctx
&&
data
);
TcpClient
::
Ptr
*
client
=
(
TcpClient
::
Ptr
*
)
ctx
;
(
*
client
)
->
send
(
data
,
len
);
(
*
client
)
->
SockSender
::
send
(
data
,
len
);
}
API_EXPORT
void
API_CALL
mk_tcp_client_send_safe
(
mk_tcp_client
ctx
,
const
char
*
data
,
int
len
){
...
...
src/Http/HttpClient.cpp
查看文件 @
4d84661a
...
...
@@ -113,7 +113,7 @@ void HttpClient::onConnect(const SockException &ex) {
printer
<<
pr
.
first
+
": "
;
printer
<<
pr
.
second
+
"
\r\n
"
;
}
send
(
printer
<<
"
\r\n
"
);
SockSender
::
send
(
printer
<<
"
\r\n
"
);
onFlush
();
}
...
...
src/Http/HttpSession.cpp
查看文件 @
4d84661a
...
...
@@ -456,7 +456,7 @@ void HttpSession::sendResponse(const char *pcStatus,
str
+=
"
\r\n
"
;
}
str
+=
"
\r\n
"
;
send
(
std
::
move
(
str
));
SockSender
::
send
(
std
::
move
(
str
));
_ticker
.
resetTime
();
if
(
!
size
){
...
...
@@ -611,7 +611,7 @@ void HttpSession::setSocketFlags(){
//推流模式下,关闭TCP_NODELAY会增加推流端的延时,但是服务器性能将提高
SockUtil
::
setNoDelay
(
_sock
->
rawFD
(),
false
);
//播放模式下,开启MSG_MORE会增加延时,但是能提高发送性能
(
*
this
)
<<
Socket
Flags
(
SOCKET_DEFAULE_FLAGS
|
FLAG_MORE
);
setSend
Flags
(
SOCKET_DEFAULE_FLAGS
|
FLAG_MORE
);
}
}
...
...
src/Http/WebSocketClient.h
查看文件 @
4d84661a
...
...
@@ -73,7 +73,7 @@ public:
HttpWsClient
(
ClientTypeImp
<
ClientType
,
DataType
>
&
delegate
)
:
_delegate
(
delegate
){
_Sec_WebSocket_Key
=
encodeBase64
(
SHA1
::
encode_bin
(
makeRandStr
(
16
,
false
)));
setPoller
(
delegate
.
getPoller
()
);
_poller
=
delegate
.
getPoller
(
);
}
~
HttpWsClient
(){}
...
...
src/Rtmp/RtmpPusher.cpp
查看文件 @
4d84661a
...
...
@@ -231,7 +231,7 @@ void RtmpPusher::setSocketFlags(){
GET_CONFIG
(
bool
,
ultraLowDelay
,
General
::
kUltraLowDelay
);
if
(
!
ultraLowDelay
)
{
//提高发送性能
(
*
this
)
<<
Socket
Flags
(
SOCKET_DEFAULE_FLAGS
|
FLAG_MORE
);
setSend
Flags
(
SOCKET_DEFAULE_FLAGS
|
FLAG_MORE
);
SockUtil
::
setNoDelay
(
_sock
->
rawFD
(),
false
);
}
}
...
...
src/Rtmp/RtmpSession.cpp
查看文件 @
4d84661a
...
...
@@ -536,7 +536,7 @@ void RtmpSession::setSocketFlags(){
//推流模式下,关闭TCP_NODELAY会增加推流端的延时,但是服务器性能将提高
SockUtil
::
setNoDelay
(
_sock
->
rawFD
(),
false
);
//播放模式下,开启MSG_MORE会增加延时,但是能提高发送性能
(
*
this
)
<<
Socket
Flags
(
SOCKET_DEFAULE_FLAGS
|
FLAG_MORE
);
setSend
Flags
(
SOCKET_DEFAULE_FLAGS
|
FLAG_MORE
);
}
}
...
...
src/Rtsp/RtspPlayer.cpp
查看文件 @
4d84661a
...
...
@@ -701,7 +701,7 @@ void RtspPlayer::sendRtspRequest(const string &cmd, const string &url,const StrC
for
(
auto
&
pr
:
header
){
printer
<<
pr
.
first
<<
": "
<<
pr
.
second
<<
"
\r\n
"
;
}
send
(
printer
<<
"
\r\n
"
);
SockSender
::
send
(
printer
<<
"
\r\n
"
);
}
void
RtspPlayer
::
onRecvRTP_l
(
const
RtpPacket
::
Ptr
&
pkt
,
const
SdpTrack
::
Ptr
&
track
)
{
...
...
src/Rtsp/RtspPusher.cpp
查看文件 @
4d84661a
...
...
@@ -395,7 +395,7 @@ void RtspPusher::setSocketFlags(){
GET_CONFIG
(
bool
,
ultraLowDelay
,
General
::
kUltraLowDelay
);
if
(
!
ultraLowDelay
)
{
//提高发送性能
(
*
this
)
<<
Socket
Flags
(
SOCKET_DEFAULE_FLAGS
|
FLAG_MORE
);
setSend
Flags
(
SOCKET_DEFAULE_FLAGS
|
FLAG_MORE
);
SockUtil
::
setNoDelay
(
_sock
->
rawFD
(),
false
);
}
}
...
...
@@ -471,7 +471,7 @@ void RtspPusher::sendRtspRequest(const string &cmd, const string &url,const StrC
if
(
!
sdp
.
empty
()){
printer
<<
sdp
;
}
send
(
printer
);
SockSender
::
send
(
printer
);
}
...
...
src/Rtsp/RtspSession.cpp
查看文件 @
4d84661a
...
...
@@ -1244,7 +1244,7 @@ void RtspSession::setSocketFlags(){
//推流模式下,关闭TCP_NODELAY会增加推流端的延时,但是服务器性能将提高
SockUtil
::
setNoDelay
(
_sock
->
rawFD
(),
false
);
//播放模式下,开启MSG_MORE会增加延时,但是能提高发送性能
(
*
this
)
<<
Socket
Flags
(
SOCKET_DEFAULE_FLAGS
|
FLAG_MORE
);
setSend
Flags
(
SOCKET_DEFAULE_FLAGS
|
FLAG_MORE
);
}
}
...
...
src/Shell/ShellSession.cpp
查看文件 @
4d84661a
...
...
@@ -41,7 +41,7 @@ void ShellSession::onRecv(const Buffer::Ptr&buf) {
_beatTicker
.
resetTime
();
_strRecvBuf
.
append
(
buf
->
data
(),
buf
->
size
());
if
(
_strRecvBuf
.
find
(
"
\xff\xf4\xff\0
xfd
\x06
"
)
!=
std
::
string
::
npos
)
{
send
(
"
\033
[0m
\r\n
Bye bye!
\r\n
"
);
SockSender
::
send
(
"
\033
[0m
\r\n
Bye bye!
\r\n
"
);
shutdown
(
SockException
(
Err_other
,
"received Ctrl+C"
));
return
;
}
...
...
@@ -78,20 +78,20 @@ inline bool ShellSession::onCommandLine(const string& line) {
try
{
std
::
shared_ptr
<
stringstream
>
ss
(
new
stringstream
);
CMDRegister
::
Instance
()(
line
,
ss
);
send
(
ss
->
str
());
SockSender
::
send
(
ss
->
str
());
}
catch
(
ExitException
&
ex
){
return
false
;
}
catch
(
std
::
exception
&
ex
){
send
(
ex
.
what
());
send
(
"
\r\n
"
);
SockSender
::
send
(
ex
.
what
());
SockSender
::
send
(
"
\r\n
"
);
}
printShellPrefix
();
return
true
;
}
inline
void
ShellSession
::
pleaseInputUser
()
{
send
(
"
\033
[0m"
);
send
(
StrPrinter
<<
SERVER_NAME
<<
" login: "
<<
endl
);
SockSender
::
send
(
"
\033
[0m"
);
SockSender
::
send
(
StrPrinter
<<
SERVER_NAME
<<
" login: "
<<
endl
);
_loginInterceptor
=
[
this
](
const
string
&
user_name
)
{
_strUserName
=
user_name
;
pleaseInputPasswd
();
...
...
@@ -99,24 +99,24 @@ inline void ShellSession::pleaseInputUser() {
};
}
inline
void
ShellSession
::
pleaseInputPasswd
()
{
send
(
"Password:
\033
[8m"
);
SockSender
::
send
(
"Password:
\033
[8m"
);
_loginInterceptor
=
[
this
](
const
string
&
passwd
)
{
auto
onAuth
=
[
this
](
const
string
&
errMessage
){
if
(
!
errMessage
.
empty
()){
//鉴权失败
send
(
StrPrinter
<<
"
\033
[0mAuth failed("
SockSender
::
send
(
StrPrinter
<<
"
\033
[0mAuth failed("
<<
errMessage
<<
"), please try again.
\r\n
"
<<
_strUserName
<<
"@"
<<
SERVER_NAME
<<
"'s password:
\033
[8m"
<<
endl
);
<<
"), please try again.
\r\n
"
<<
_strUserName
<<
"@"
<<
SERVER_NAME
<<
"'s password:
\033
[8m"
<<
endl
);
return
;
}
send
(
"
\033
[0m"
);
send
(
"-----------------------------------------
\r\n
"
);
send
(
StrPrinter
<<
"欢迎来到"
<<
SERVER_NAME
<<
", 你可输入
\"
help
\"
查看帮助.
\r\n
"
<<
endl
);
send
(
"-----------------------------------------
\r\n
"
);
SockSender
::
send
(
"
\033
[0m"
);
SockSender
::
send
(
"-----------------------------------------
\r\n
"
);
SockSender
::
send
(
StrPrinter
<<
"欢迎来到"
<<
SERVER_NAME
<<
", 你可输入
\"
help
\"
查看帮助.
\r\n
"
<<
endl
);
SockSender
::
send
(
"-----------------------------------------
\r\n
"
);
printShellPrefix
();
_loginInterceptor
=
nullptr
;
};
...
...
@@ -146,7 +146,7 @@ inline void ShellSession::pleaseInputPasswd() {
}
inline
void
ShellSession
::
printShellPrefix
()
{
send
(
StrPrinter
<<
_strUserName
<<
"@"
<<
SERVER_NAME
<<
"# "
<<
endl
);
SockSender
::
send
(
StrPrinter
<<
_strUserName
<<
"@"
<<
SERVER_NAME
<<
"# "
<<
endl
);
}
}
/* namespace mediakit */
tests/test_wsClient.cpp
查看文件 @
4d84661a
...
...
@@ -36,7 +36,7 @@ protected:
}
//tcp连接成功后每2秒触发一次该事件
void
onManager
()
override
{
send
(
"echo test!"
);
SockSender
::
send
(
"echo test!"
);
DebugL
<<
"send echo test"
;
}
//连接服务器结果回调
...
...
tests/test_wsServer.cpp
查看文件 @
4d84661a
...
...
@@ -35,7 +35,7 @@ public:
}
void
onRecv
(
const
Buffer
::
Ptr
&
buffer
)
override
{
//回显数据
send
(
"from EchoSession:"
);
SockSender
::
send
(
"from EchoSession:"
);
send
(
buffer
);
}
void
onError
(
const
SockException
&
err
)
override
{
...
...
@@ -62,7 +62,7 @@ public:
}
void
onRecv
(
const
Buffer
::
Ptr
&
buffer
)
override
{
//回显数据
send
(
"from EchoSessionWithUrl:"
);
SockSender
::
send
(
"from EchoSessionWithUrl:"
);
send
(
buffer
);
}
void
onError
(
const
SockException
&
err
)
override
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论