Skip to content

Commit d6ae2b9

Browse files
committed
move channel implementations to details namespace
1 parent f1a73de commit d6ae2b9

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

include/scl/net/loopback.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "scl/coro/task.h"
2525
#include "scl/net/channel.h"
2626

27-
namespace scl {
27+
namespace scl::details {
2828

2929
/**
3030
* @brief A loopback channel.

include/scl/net/tcp/channel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include "scl/net/channel.h"
2121

22-
namespace scl {
22+
namespace scl::details {
2323

2424
/**
2525
* @brief A channel implementation using TCP.

src/scl/net/tcp/channel.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
using namespace scl;
2525

26-
void TcpChannel::close() {
26+
void details::TcpChannel::close() {
2727
if (m_alive) {
2828
// ensures that we only attempt to close the socket once, even if closing
2929
// the somehow socket fails.
@@ -37,11 +37,11 @@ void TcpChannel::close() {
3737
}
3838
}
3939

40-
Task<void> TcpChannel::send(Packet&& packet) {
40+
Task<void> details::TcpChannel::send(Packet&& packet) {
4141
co_await send(packet);
4242
}
4343

44-
Task<void> TcpChannel::send(const Packet& packet) {
44+
Task<void> details::TcpChannel::send(const Packet& packet) {
4545
// Write the packet size to a buffer.
4646
const Packet::SizeType pkt_sz = packet.dataSize();
4747
const auto pkt_t_sz = sizeof(Packet::SizeType);
@@ -126,7 +126,7 @@ Task<bool> recvInto(int socket,
126126

127127
} // namespace
128128

129-
Task<Packet> TcpChannel::recv() {
129+
Task<Packet> details::TcpChannel::recv() {
130130
unsigned char packet_size_buf[sizeof(Packet::SizeType)] = {0};
131131

132132
// read size of the packet.
@@ -141,7 +141,7 @@ Task<Packet> TcpChannel::recv() {
141141
co_return packet;
142142
}
143143

144-
Task<std::optional<Packet>> TcpChannel::recv(Time::Duration timeout) {
144+
Task<std::optional<Packet>> details::TcpChannel::recv(Time::Duration timeout) {
145145
unsigned char packet_size_buf[sizeof(Packet::SizeType)] = {0};
146146

147147
// attempt to read the size of the packet. If we timeout here, we will simply
@@ -167,6 +167,6 @@ Task<std::optional<Packet>> TcpChannel::recv(Time::Duration timeout) {
167167
co_return packet;
168168
}
169169

170-
Task<bool> TcpChannel::poll() {
170+
Task<bool> details::TcpChannel::poll() {
171171
co_return details::pollSocket(m_socket, POLLIN);
172172
}

src/scl/net/tcp/network.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ Task<Network> scl::createTcpNetwork(const NetworkConfig& config) {
148148
const std::size_t id = config.id();
149149
const std::size_t n = config.networkSize();
150150

151-
channels[id] = LoopbackChannel::create();
151+
channels[id] = details::LoopbackChannel::create();
152152

153153
std::vector<Task<SocketAndId>> tasks;
154154

@@ -168,7 +168,7 @@ Task<Network> scl::createTcpNetwork(const NetworkConfig& config) {
168168
details::sys_call::close(server_socket);
169169

170170
for (const SocketAndId& sai : sais) {
171-
channels[sai.id] = std::make_shared<TcpChannel>(sai.socket);
171+
channels[sai.id] = std::make_shared<details::TcpChannel>(sai.socket);
172172
}
173173

174174
co_return Network{channels, config.id()};

src/scl/simulation/simulator.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ std::vector<std::shared_ptr<Channel>> createChannels(
144144

145145
for (std::size_t remote_pid = 0; remote_pid < n; remote_pid++) {
146146
if (remote_pid == local_pid) {
147-
channels.emplace_back(LoopbackChannel::create());
147+
channels.emplace_back(details::LoopbackChannel::create());
148148
} else {
149149
ChannelId id(local_pid, remote_pid);
150150
channels.emplace_back(

test/scl/net/test_loopback.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
using namespace scl;
2626

2727
TEST_CASE("Loopback to self close", "[net]") {
28-
auto channel = LoopbackChannel::create();
28+
auto channel = details::LoopbackChannel::create();
2929

3030
Packet p;
3131
p << 1 << 2 << 3;
@@ -41,7 +41,7 @@ TEST_CASE("Loopback to self close", "[net]") {
4141
}
4242

4343
TEST_CASE("Loopback send/recv", "[net]") {
44-
auto channels = LoopbackChannel::createPaired();
44+
auto channels = details::LoopbackChannel::createPaired();
4545
auto chl0 = channels[0];
4646
auto chl1 = channels[1];
4747

0 commit comments

Comments
 (0)