blob: 4524e15da7256c33fb31a384a5afa8bd425e6049 (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <unistd.h>
#include <stdarg.h>
#include <cstdio>
#include <cstring>
#include <vespa/log/log.h>
LOG_SETUP("");
#include <vespa/log/llparser.h>
#include "output-connection.h"
#include "line-splitter.h"
namespace config {
namespace sentinel {
OutputConnection::OutputConnection(int f, ns_log::LLParser *p)
: _fd(f),
_lines(f),
_parser(p)
{
}
bool
OutputConnection::isFinished() const
{
return _lines.eof();
}
void
OutputConnection::handleOutput()
{
while (1) {
char *line = _lines.getLine();
if (!line) {
return;
}
LOG(spam, "Got Output from connection: '%s'", line);
_parser->doInput(line);
}
}
OutputConnection::~OutputConnection()
{
close(_fd);
delete _parser;
}
} // end namespace config::sentinel
} // end namespace config
|