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-09-22 17:46:07 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9a9483e7d5df45b3f8cbdff1a483381ffe3c9262
9a9483e7
1 parent
abb5c5ad
support without kafka
显示空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
38 行增加
和
1 行删除
trunk/src/app/srs_app_kafka.cpp
trunk/src/app/srs_app_kafka.hpp
trunk/src/app/srs_app_server.cpp
trunk/src/app/srs_app_server.hpp
trunk/src/protocol/srs_kafka_stack.cpp
trunk/src/protocol/srs_kafka_stack.hpp
trunk/src/app/srs_app_kafka.cpp
查看文件 @
9a9483e
...
...
@@ -28,6 +28,8 @@
#include <srs_app_config.hpp>
#include <srs_app_async_call.hpp>
#ifdef SRS_AUTO_KAFKA
SrsKafkaProducer
::
SrsKafkaProducer
()
{
worker
=
new
SrsAsyncCallWorker
();
...
...
@@ -66,3 +68,5 @@ void SrsKafkaProducer::stop()
worker
->
stop
();
}
#endif
...
...
trunk/src/app/srs_app_kafka.hpp
查看文件 @
9a9483e
...
...
@@ -31,6 +31,11 @@
class
SrsAsyncCallWorker
;
#ifdef SRS_AUTO_KAFKA
/**
* the kafka producer used to save log to kafka cluster.
*/
class
SrsKafkaProducer
{
private
:
...
...
@@ -45,3 +50,6 @@ public:
};
#endif
#endif
...
...
trunk/src/app/srs_app_server.cpp
查看文件 @
9a9483e
...
...
@@ -509,7 +509,9 @@ SrsServer::SrsServer()
#ifdef SRS_AUTO_INGEST
ingester
=
NULL
;
#endif
#ifdef SRS_AUTO_KAFKA
kafka
=
new
SrsKafkaProducer
();
#endif
}
SrsServer
::~
SrsServer
()
...
...
@@ -539,7 +541,9 @@ void SrsServer::destroy()
srs_freep
(
ingester
);
#endif
#ifdef SRS_AUTO_KAFKA
srs_freep
(
kafka
);
#endif
if
(
pid_fd
>
0
)
{
::
close
(
pid_fd
);
...
...
@@ -565,7 +569,9 @@ void SrsServer::dispose()
ingester
->
dispose
();
#endif
#ifdef SRS_AUTO_KAFKA
kafka
->
stop
();
#endif
SrsSource
::
dispose_all
();
...
...
@@ -874,12 +880,19 @@ int SrsServer::start_kafka()
{
int
ret
=
ERROR_SUCCESS
;
#ifdef SRS_AUTO_KAFKA
if
((
ret
=
kafka
->
initialize
())
!=
ERROR_SUCCESS
)
{
srs_error
(
"initialize the kafka producer failed. ret=%d"
,
ret
);
return
ret
;
}
return
kafka
->
start
();
if
((
ret
=
kafka
->
start
())
!=
ERROR_SUCCESS
)
{
srs_error
(
"start kafka failed. ret=%d"
,
ret
);
return
ret
;
}
#endif
return
ret
;
}
int
SrsServer
::
cycle
()
...
...
trunk/src/app/srs_app_server.hpp
查看文件 @
9a9483e
...
...
@@ -55,7 +55,9 @@ class SrsTcpListener;
#ifdef SRS_AUTO_STREAM_CASTER
class
SrsAppCasterFlv
;
#endif
#ifdef SRS_AUTO_KAFKA
class
SrsKafkaProducer
;
#endif
// listener type for server to identify the connection,
// that is, use different type to process the connection.
...
...
@@ -248,7 +250,9 @@ private:
#ifdef SRS_AUTO_INGEST
SrsIngester
*
ingester
;
#endif
#ifdef SRS_AUTO_KAFKA
SrsKafkaProducer
*
kafka
;
#endif
private
:
/**
* the pid file fd, lock the file write when server is running.
...
...
trunk/src/protocol/srs_kafka_stack.cpp
查看文件 @
9a9483e
...
...
@@ -25,6 +25,8 @@
using
namespace
std
;
#ifdef SRS_AUTO_KAFKA
SrsKafkaString
::
SrsKafkaString
()
{
size
=
-
1
;
...
...
@@ -194,3 +196,5 @@ SrsKafkaTopicMetadataRequest::~SrsKafkaTopicMetadataRequest()
{
}
#endif
...
...
trunk/src/protocol/srs_kafka_stack.hpp
查看文件 @
9a9483e
...
...
@@ -31,6 +31,8 @@
#include <vector>
#ifdef SRS_AUTO_KAFKA
// https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-ApiKeys
enum
SrsKafkaApiKey
{
...
...
@@ -310,3 +312,5 @@ public:
#endif
#endif
...
...
请
注册
或
登录
后发表评论