| 88 | }; |
| 89 | |
| 90 | int main(int argc, char* argv[]) { |
| 91 | GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); |
| 92 | |
| 93 | brpc::Server server; |
| 94 | server.set_version("trackme_server"); |
| 95 | BugsLoader bugs; |
| 96 | if (!bugs.start(FLAGS_bug_file)) { |
| 97 | LOG(ERROR) << "Fail to start BugsLoader"; |
| 98 | return -1; |
| 99 | } |
| 100 | TrackMeServiceImpl echo_service_impl(&bugs); |
| 101 | if (server.AddService(&echo_service_impl, |
| 102 | brpc::SERVER_DOESNT_OWN_SERVICE) != 0) { |
| 103 | LOG(ERROR) << "Fail to add service"; |
| 104 | return -1; |
| 105 | } |
| 106 | brpc::ServerOptions options; |
| 107 | // I've noticed that many connections do not report. Don't know the |
| 108 | // root cause yet. Set the idle_time to keep connections clean. |
| 109 | options.idle_timeout_sec = FLAGS_reporting_interval * 2; |
| 110 | if (server.Start(FLAGS_port, &options) != 0) { |
| 111 | LOG(ERROR) << "Fail to start TrackMeServer"; |
| 112 | return -1; |
| 113 | } |
| 114 | server.RunUntilAskedToQuit(); |
| 115 | bugs.stop(); |
| 116 | return 0; |
| 117 | } |
| 118 | |
| 119 | BugsLoader::BugsLoader() |
| 120 | : _started(false) |
nothing calls this directly
no test coverage detected