blob: 398797967a6c6028c0ed8ddb7b39a2acf3051ece (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "tcpdirective.h"
#include <vespa/vespalib/stllike/asciistream.h>
namespace mbus {
TcpDirective::TcpDirective(vespalib::stringref host, uint32_t port, vespalib::stringref session) :
_host(host),
_port(port),
_session(session)
{
// empty
}
TcpDirective::~TcpDirective() = default;
bool
TcpDirective::matches(const IHopDirective &dir) const
{
if (dir.getType() != TYPE_TCP) {
return false;
}
const TcpDirective &rhs = static_cast<const TcpDirective&>(dir);
return _host == rhs._host && _port == rhs._port && _session == rhs._session;
}
string
TcpDirective::toString() const
{
vespalib::asciistream os;
os << "tcp/" << _host << ':' << _port << '/' << _session;
return os.str();
}
string
TcpDirective::toDebugString() const
{
vespalib::asciistream os;
os << "TcpDirective(host = '" << _host << "', port = " << _port << ", session = '" << _session << "')";
return os.str();
}
} // mbus
|