MCPcopy Create free account
hub / github.com/apache/brpc / main

Function main

tools/trackme_server/trackme_server.cpp:90–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88};
89
90int 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
119BugsLoader::BugsLoader()
120 : _started(false)

Callers

nothing calls this directly

Calls 6

AddServiceMethod · 0.80
RunUntilAskedToQuitMethod · 0.80
set_versionMethod · 0.45
startMethod · 0.45
StartMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected