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
2015-10-22 17:43:15 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7a0aaf5900604de8e600b29b8de270a72fb18f57
7a0aaf59
1 parent
f9f5b569
kafka refine code
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
10 行增加
和
6 行删除
trunk/src/app/srs_app_kafka.cpp
trunk/src/app/srs_app_kafka.cpp
查看文件 @
7a0aaf5
...
...
@@ -281,28 +281,32 @@ int SrsKafkaCache::flush(SrsKafkaPartition* partition, int key, SrsKafkaPartitio
// ensure the key exists.
srs_assert
(
cache
.
find
(
key
)
!=
cache
.
end
());
// the cache is vector, which is continous store.
// we remember the messages we have written and clear it when completed.
int
nb_msgs
=
(
int
)
pc
->
size
();
if
(
pc
->
empty
())
{
return
ret
;
}
// connect transport.
if
((
ret
=
partition
->
connect
())
!=
ERROR_SUCCESS
)
{
srs_error
(
"connect to partition failed. ret=%d"
,
ret
);
return
ret
;
}
// copy the messages to a temp cache.
SrsKafkaPartitionCache
tpc
(
*
pc
);
// TODO: FIXME: implements it.
// free all wrote messages.
for
(
vector
<
SrsJsonObject
*>::
iterator
it
=
tpc
.
begin
();
it
!=
tpc
.
end
();
++
it
)
{
for
(
vector
<
SrsJsonObject
*>::
iterator
it
=
pc
->
begin
();
it
!=
pc
->
end
();
++
it
)
{
SrsJsonObject
*
obj
=
*
it
;
srs_freep
(
obj
);
}
// remove the messages from cache.
if
(
pc
->
size
()
==
tpc
.
size
()
)
{
if
(
pc
->
size
()
==
nb_msgs
)
{
pc
->
clear
();
}
else
{
pc
->
erase
(
pc
->
begin
(),
pc
->
begin
()
+
tpc
.
size
()
);
pc
->
erase
(
pc
->
begin
(),
pc
->
begin
()
+
nb_msgs
);
}
return
ret
;
...
...
请
注册
或
登录
后发表评论