Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-04-22 12:20:58 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
36d8fdfc1a45c623b021e46123128f5eb9b567dd
36d8fdfc
1 parent
a73bf8d4
move the ts buffer to http message
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
17 行增加
和
4 行删除
trunk/src/app/srs_app_http.cpp
trunk/src/app/srs_app_http.hpp
trunk/src/app/srs_app_http_conn.cpp
trunk/src/app/srs_app_http.cpp
查看文件 @
36d8fdf
...
...
@@ -515,6 +515,7 @@ SrsHttpMessage::SrsHttpMessage()
_uri
=
new
SrsHttpUri
();
_match
=
NULL
;
_requires_crossdomain
=
false
;
_http_ts_send_buffer
=
new
char
[
HTTP_TS_SEND_BUFFER_SIZE
];
}
SrsHttpMessage
::~
SrsHttpMessage
()
...
...
@@ -522,6 +523,12 @@ SrsHttpMessage::~SrsHttpMessage()
srs_freep
(
_body
);
srs_freep
(
_uri
);
srs_freep
(
_match
);
srs_freepa
(
_http_ts_send_buffer
);
}
char
*
SrsHttpMessage
::
http_ts_send_buffer
()
{
return
_http_ts_send_buffer
;
}
void
SrsHttpMessage
::
reset
()
...
...
trunk/src/app/srs_app_http.hpp
查看文件 @
36d8fdf
...
...
@@ -145,6 +145,9 @@ class SrsHttpHandler;
#define HTTP_GatewayTimeout_str "Gateway Timeout"
#define HTTP_HTTPVersionNotSupported_str "HTTP Version Not Supported"
// @see SrsHttpMessage._http_ts_send_buffer
#define HTTP_TS_SEND_BUFFER_SIZE 4096
// linux path seprator
#define __PATH_SEP '/'
// query string seprator
...
...
@@ -310,10 +313,15 @@ private:
* whether the message requires crossdomain.
*/
bool
_requires_crossdomain
;
/**
* use a buffer to read and send ts file.
*/
char
*
_http_ts_send_buffer
;
public
:
SrsHttpMessage
();
virtual
~
SrsHttpMessage
();
public
:
virtual
char
*
http_ts_send_buffer
();
virtual
void
reset
();
virtual
int
parse_uri
();
public
:
...
...
trunk/src/app/srs_app_http_conn.cpp
查看文件 @
36d8fdf
...
...
@@ -195,14 +195,12 @@ int SrsHttpVhost::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
// write body.
int64_t
left
=
length
;
const
static
int
HTTP_PKT_SIZE
=
4096
;
char
*
buf
=
new
char
[
HTTP_PKT_SIZE
];
SrsAutoFree
(
char
,
buf
,
true
);
char
*
buf
=
req
->
http_ts_send_buffer
();
while
(
left
>
0
)
{
ssize_t
nread
=
-
1
;
// TODO: FIXME: use st_read.
if
((
nread
=
::
read
(
fd
,
buf
,
HTTP_
PKT
_SIZE
))
<
0
)
{
if
((
nread
=
::
read
(
fd
,
buf
,
HTTP_
TS_SEND_BUFFER
_SIZE
))
<
0
)
{
::
close
(
fd
);
ret
=
ERROR_HTTP_READ_FILE
;
srs_warn
(
"read file %s failed, ret=%d"
,
fullpath
.
c_str
(),
ret
);
...
...
请
注册
或
登录
后发表评论