正在显示
2 个修改的文件
包含
10 行增加
和
4 行删除
@@ -205,7 +205,7 @@ int SrsServer::initialize() | @@ -205,7 +205,7 @@ int SrsServer::initialize() | ||
205 | { | 205 | { |
206 | int ret = ERROR_SUCCESS; | 206 | int ret = ERROR_SUCCESS; |
207 | 207 | ||
208 | - // for the main objects(server, config, log), | 208 | + // for the main objects(server, config, log, context), |
209 | // never subscribe handler in constructor, | 209 | // never subscribe handler in constructor, |
210 | // instead, subscribe handler in initialize method. | 210 | // instead, subscribe handler in initialize method. |
211 | srs_assert(_srs_config); | 211 | srs_assert(_srs_config); |
@@ -42,6 +42,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -42,6 +42,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
42 | #include <srs_app_log.hpp> | 42 | #include <srs_app_log.hpp> |
43 | #include <srs_app_utility.hpp> | 43 | #include <srs_app_utility.hpp> |
44 | 44 | ||
45 | +// pre-declare | ||
46 | +int run(); | ||
47 | +int run_master(); | ||
48 | + | ||
49 | +// for the main objects(server, config, log, context), | ||
50 | +// never subscribe handler in constructor, | ||
51 | +// instead, subscribe handler in initialize method. | ||
45 | // kernel module. | 52 | // kernel module. |
46 | ISrsLog* _srs_log = new SrsFastLog(); | 53 | ISrsLog* _srs_log = new SrsFastLog(); |
47 | ISrsThreadContext* _srs_context = new SrsThreadContext(); | 54 | ISrsThreadContext* _srs_context = new SrsThreadContext(); |
@@ -49,15 +56,14 @@ ISrsThreadContext* _srs_context = new SrsThreadContext(); | @@ -49,15 +56,14 @@ ISrsThreadContext* _srs_context = new SrsThreadContext(); | ||
49 | SrsConfig* _srs_config = new SrsConfig(); | 56 | SrsConfig* _srs_config = new SrsConfig(); |
50 | SrsServer* _srs_server = new SrsServer(); | 57 | SrsServer* _srs_server = new SrsServer(); |
51 | 58 | ||
59 | +// signal handler | ||
52 | void handler(int signo) | 60 | void handler(int signo) |
53 | { | 61 | { |
54 | srs_trace("get a signal, signo=%d", signo); | 62 | srs_trace("get a signal, signo=%d", signo); |
55 | _srs_server->on_signal(signo); | 63 | _srs_server->on_signal(signo); |
56 | } | 64 | } |
57 | 65 | ||
58 | -int run(); | ||
59 | -int run_master(); | ||
60 | - | 66 | +// main entrance. |
61 | int main(int argc, char** argv) | 67 | int main(int argc, char** argv) |
62 | { | 68 | { |
63 | int ret = ERROR_SUCCESS; | 69 | int ret = ERROR_SUCCESS; |
-
请 注册 或 登录 后发表评论