Skip to content

Commit 6018dd1

Browse files
In unit tests now using localhost instead of empty string for host. Slight tweak to shutdown of tcp_io.hpp, shutdown incoming reads instead of both reads and writes.
1 parent c430466 commit 6018dd1

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

include/net_ip/detail/tcp_io.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class tcp_io : public std::enable_shared_from_this<tcp_io> {
174174
}
175175
m_io_common.clear();
176176
std::error_code ec;
177-
m_socket.shutdown(asio::ip::tcp::socket::shutdown_both, ec);
177+
m_socket.shutdown(asio::ip::tcp::socket::shutdown_receive, ec);
178178
m_socket.close(ec);
179179
// notify the acceptor or connector that this tcp_io object is closed
180180
m_notifier_cb(err, shared_from_this());
@@ -298,7 +298,7 @@ inline void tcp_io::start_write(const chops::const_shared_buffer& buf) {
298298
inline void tcp_io::handle_write(const std::error_code& err, std::size_t /* num_bytes */) {
299299
if (err) {
300300
// read pops first, so usually no error is needed in write handlers
301-
// m_notifier_cb(err, shared_from_this());
301+
close(err);
302302
return;
303303
}
304304
m_io_common.write_next_elem([this] (const chops::const_shared_buffer& buf) {

test/net_ip/detail/tcp_acceptor_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
using namespace chops::test;
6161

6262
const char* test_port = "30434";
63-
const char* test_host = "";
63+
const char* test_host = "localhost";
6464
constexpr int num_msgs = 50;
6565

6666

test/net_ip/detail/tcp_connector_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ using namespace chops::test;
6060

6161
const char* test_port_var = "30777";
6262
const char* test_port_fixed = "30778";
63-
const char* test_host = "";
63+
const char* test_host = "localhost";
6464
constexpr int num_msgs = 50;
6565
constexpr std::chrono::milliseconds tout { 800 };
6666

test/net_ip/detail/tcp_io_test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
using namespace chops::test;
4848

4949
const char* test_port = "30434";
50-
const char* test_addr = "";
50+
const char* test_addr = "localhost";
5151
constexpr int num_msgs = 50;
5252

5353
// Catch test framework is not thread-safe, therefore all REQUIRE clauses must be in a single
@@ -153,6 +153,7 @@ void perform_test (const vec_buf& var_msg_vec, const vec_buf& fixed_msg_vec,
153153
auto res =
154154
chops::net::endpoints_resolver<asio::ip::tcp>(ioc).make_endpoints(true, test_addr, test_port);
155155
REQUIRE(res);
156+
156157
asio::ip::tcp::acceptor acc(ioc, *(res->cbegin()));
157158

158159
{

test/net_ip/net_ip_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
using namespace chops::test;
4747

4848
const char* tcp_test_port = "30465";
49-
const char* tcp_test_host = "";
49+
const char* tcp_test_host = "localhost";
5050
constexpr int num_msgs = 50;
5151

5252
const char* udp_test_addr = "127.0.0.1";

0 commit comments

Comments
 (0)