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-23 17:21:57 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
afd64283660b998992e2c667e9c74449f0856ccd
afd64283
1 parent
8b6c78b8
refine code of server.
显示空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
33 行增加
和
34 行删除
trunk/src/app/srs_app_server.cpp
trunk/src/app/srs_app_server.hpp
trunk/src/app/srs_app_server.cpp
查看文件 @
afd6428
...
...
@@ -918,29 +918,6 @@ int SrsServer::cycle()
return
ret
;
}
void
SrsServer
::
remove
(
SrsConnection
*
conn
)
{
std
::
vector
<
SrsConnection
*>::
iterator
it
=
std
::
find
(
conns
.
begin
(),
conns
.
end
(),
conn
);
// removed by destroy, ignore.
if
(
it
==
conns
.
end
())
{
srs_warn
(
"server moved connection, ignore."
);
return
;
}
conns
.
erase
(
it
);
srs_info
(
"conn removed. conns=%d"
,
(
int
)
conns
.
size
());
SrsStatistic
*
stat
=
SrsStatistic
::
instance
();
stat
->
kbps_add_delta
(
conn
);
stat
->
on_disconnect
(
conn
->
srs_id
());
// all connections are created by server,
// so we free it here.
srs_freep
(
conn
);
}
void
SrsServer
::
on_signal
(
int
signo
)
{
if
(
signo
==
SRS_SIGNAL_RELOAD
)
{
...
...
@@ -1002,10 +979,9 @@ int SrsServer::do_cycle()
int
heartbeat_max_resolution
=
(
int
)(
_srs_config
->
get_heartbeat_interval
()
/
SRS_SYS_CYCLE_INTERVAL
);
// dynamic fetch the max.
int
temp_max
=
max
;
temp_max
=
srs_max
(
temp_max
,
heartbeat_max_resolution
);
int
dynamic_max
=
srs_max
(
max
,
heartbeat_max_resolution
);
for
(
int
i
=
0
;
i
<
temp
_max
;
i
++
)
{
for
(
int
i
=
0
;
i
<
dynamic
_max
;
i
++
)
{
st_usleep
(
SRS_SYS_CYCLE_INTERVAL
*
1000
);
// gracefully quit for SIGINT or SIGTERM(SRS_SIGNAL_GRACEFULLY_QUIT).
...
...
@@ -1331,6 +1307,29 @@ int SrsServer::accept_client(SrsListenerType type, st_netfd_t client_stfd)
return
ret
;
}
void
SrsServer
::
remove
(
SrsConnection
*
conn
)
{
std
::
vector
<
SrsConnection
*>::
iterator
it
=
std
::
find
(
conns
.
begin
(),
conns
.
end
(),
conn
);
// removed by destroy, ignore.
if
(
it
==
conns
.
end
())
{
srs_warn
(
"server moved connection, ignore."
);
return
;
}
conns
.
erase
(
it
);
srs_info
(
"conn removed. conns=%d"
,
(
int
)
conns
.
size
());
SrsStatistic
*
stat
=
SrsStatistic
::
instance
();
stat
->
kbps_add_delta
(
conn
);
stat
->
on_disconnect
(
conn
->
srs_id
());
// all connections are created by server,
// so we free it here.
srs_freep
(
conn
);
}
int
SrsServer
::
on_reload_listen
()
{
return
listen
();
...
...
trunk/src/app/srs_app_server.hpp
查看文件 @
afd6428
...
...
@@ -315,14 +315,6 @@ public:
virtual
int
ingest
();
virtual
int
start_kafka
();
virtual
int
cycle
();
// IConnectionManager
public:
/**
* callback for connection to remove itself.
* when connection thread cycle terminated, callback this to delete connection.
* @see SrsConnection.on_thread_stop().
*/
virtual
void
remove
(
SrsConnection
*
conn
);
// server utilities.
public:
/**
...
...
@@ -372,6 +364,14 @@ public:
* @param client_stfd, the client fd in st boxed, the underlayer fd.
*/
virtual
int
accept_client
(
SrsListenerType
type
,
st_netfd_t
client_stfd
);
// IConnectionManager
public:
/**
* callback for connection to remove itself.
* when connection thread cycle terminated, callback this to delete connection.
* @see SrsConnection.on_thread_stop().
*/
virtual
void
remove
(
SrsConnection
*
conn
);
// interface ISrsReloadHandler.
public:
virtual
int
on_reload_listen
();
...
...
请
注册
或
登录
后发表评论