| 153 | }; |
| 154 | |
| 155 | int main(int argc, char* argv[]) { |
| 156 | GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true); |
| 157 | if (FLAGS_target.empty() && |
| 158 | (argc != 2 || |
| 159 | GFLAGS_NAMESPACE::SetCommandLineOption("target", argv[1]).empty())) { |
| 160 | LOG(ERROR) << "Usage: ./rpc_view <ip>:<port>"; |
| 161 | return -1; |
| 162 | } |
| 163 | // This keeps ad-hoc creation of channels reuse previous connections. |
| 164 | GFLAGS_NAMESPACE::SetCommandLineOption("defer_close_second", "10"); |
| 165 | |
| 166 | brpc::Server server; |
| 167 | server.set_version("rpc_view_server"); |
| 168 | brpc::ServerOptions server_opt; |
| 169 | server_opt.http_master_service = new ViewServiceImpl; |
| 170 | if (server.Start(FLAGS_port, &server_opt) != 0) { |
| 171 | LOG(ERROR) << "Fail to start ViewServer"; |
| 172 | return -1; |
| 173 | } |
| 174 | server.RunUntilAskedToQuit(); |
| 175 | return 0; |
| 176 | } |
nothing calls this directly
no test coverage detected