summaryrefslogtreecommitdiffstats
path: root/configd/src/apps/sentinel/rpcserver.cpp
blob: b719d01230460039941c06c38dee822c04cd98dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "rpcserver.h"

#include <vespa/log/log.h>
LOG_SETUP(".rpcserver");

namespace config::sentinel {

RpcServer::RpcServer(int portNumber, CommandQueue &cmdQ)
    : _supervisor(),
      _rpcHooks(cmdQ),
      _port(portNumber)
{
    _rpcHooks.initRPC(&_supervisor);
    if (_supervisor.Listen(portNumber)) {
        LOG(config, "listening on port %d", portNumber);
        _supervisor.Start();
    } else {
        LOG(error, "unable to listen to port %d", portNumber);
    }
}

RpcServer::~RpcServer()
{
    _supervisor.ShutDown(true);
}

} // namespace config::sentinel