Skip to content

Commit 9e57c46

Browse files
author
Alex Nekipelov
committed
tcp_nodelay for sync client
1 parent 54549cf commit 9e57c46

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

examples/sync_set_get.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ int main(int, char **)
3434

3535
if( result.isOk() )
3636
{
37-
std::cout << "GET " << key << ": " << result.toString() << "\n";
37+
std::cout << "GET: " << result.toString() << "\n";
3838
return EXIT_SUCCESS;
3939
}
4040
else

src/redisclient/impl/redissyncclient.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,17 @@ bool RedisSyncClient::connect(const boost::asio::ip::tcp::endpoint &endpoint,
2626
{
2727
boost::system::error_code ec;
2828

29-
pimpl->socket.connect(endpoint, ec);
29+
pimpl->socket.open(endpoint.protocol(), ec);
30+
31+
if( !ec )
32+
{
33+
pimpl->socket.set_option(boost::asio::ip::tcp::no_delay(true), ec);
34+
35+
if( !ec )
36+
{
37+
pimpl->socket.connect(endpoint, ec);
38+
}
39+
}
3040

3141
if( !ec )
3242
{

0 commit comments

Comments
 (0)