Skip to content

Commit bcd5554

Browse files
committed
Renamed connection_delegate.
1 parent 40a2309 commit bcd5554

File tree

5 files changed

+61
-32
lines changed

5 files changed

+61
-32
lines changed

http/src/network/http/v2/client/connection/async_resolver.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ namespace network {
6767

6868
/**
6969
* \brief Resolves a host asynchronously.
70+
* \param host The hostname to resolve.
71+
* \param port The port number.
72+
* \param callback A callback handler.
7073
*/
7174

7275
void async_resolve(const std::string &host, std::uint16_t port, callback_fn callback) {

http/src/network/http/v2/client/connection/connection_delegate.hpp renamed to http/src/network/http/v2/client/connection/connection.hpp

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// (See accompanying file LICENSE_1_0.txt or copy at
44
// http://www.boost.org/LICENSE_1_0.txt)
55

6-
#ifndef __NETWORK_HTTP_V2_CLIENT_CONNECTION_CONNECTION_DELEGATE_INC__
7-
#define __NETWORK_HTTP_V2_CLIENT_CONNECTION_CONNECTION_DELEGATE_INC__
6+
#ifndef __NETWORK_HTTP_V2_CLIENT_CONNECTION_CONNECTION_INC__
7+
#define __NETWORK_HTTP_V2_CLIENT_CONNECTION_CONNECTION_INC__
88

99
#include <functional>
1010
#include <string>
@@ -16,13 +16,13 @@ namespace network {
1616
namespace http {
1717
namespace v2 {
1818
/**
19-
* \class connection_delegate network/http/v2/client/connection/connection_delegate.hpp
19+
* \class connection network/http/v2/client/connection/connection.hpp
2020
* \brief Manages a connection through a socket.
2121
*/
22-
class connection_delegate {
22+
class connection {
2323

24-
connection_delegate(const connection_delegate &) = delete;
25-
connection_delegate &operator = (const connection_delegate &) = delete;
24+
connection(const connection &) = delete;
25+
connection &operator = (const connection &) = delete;
2626

2727
public:
2828

@@ -41,24 +41,50 @@ namespace network {
4141
*/
4242
typedef std::function<void (const boost::system::error_code &, std::size_t)> read_callback;
4343

44-
connection_delegate() = default;
44+
/**
45+
* \brief Constructor.
46+
*/
47+
connection() = default;
4548

46-
virtual ~connection_delegate() noexcept { }
49+
/**
50+
* \brief Destructor.
51+
*/
52+
virtual ~connection() noexcept { }
4753

54+
/**
55+
* \brief Asynchronously creates a connection to an endpoint.
56+
* \param endpoint The endpoint to which to connect.
57+
* \param host The host name.
58+
* \param callback A callback handler.
59+
*/
60+
*/
4861
virtual void async_connect(boost::asio::ip::tcp::endpoint &endpoint,
4962
const std::string &host, connect_callback callback) = 0;
5063

64+
/**
65+
* \brief Asynchronously writes data across the connection.
66+
* \param command_streambuf
67+
* \param callback A callback handler.
68+
*/
5169
virtual void async_write(boost::asio::streambuf &command_streambuf,
5270
write_callback callback) = 0;
5371

72+
/**
73+
* \brief Asynchronously reads some data from the connection.
74+
* \param read_buffer The buffer in which to read the network data.
75+
* \param callback A callback handler.
76+
*/
5477
virtual void async_read_some(const boost::asio::mutable_buffers_1 &read_buffer,
5578
read_callback callback) = 0;
5679

80+
/**
81+
* \brief Cancels an operation on a connection.
82+
*/
5783
virtual void cancel() = 0;
5884

5985
};
6086
} // namespace v2
6187
} // namespace http
6288
} // namespace network
6389

64-
#endif // __NETWORK_HTTP_V2_CLIENT_CONNECTION_CONNECTION_DELEGATE_INC__
90+
#endif // __NETWORK_HTTP_V2_CLIENT_CONNECTION_CONNECTION_INC__

http/src/network/http/v2/client/connection/normal_connection_delegate.hpp renamed to http/src/network/http/v2/client/connection/normal_connection.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,29 @@
33
// (See accompanying file LICENSE_1_0.txt or copy at
44
// http://www.boost.org/LICENSE_1_0.txt)
55

6-
#ifndef __NETWORK_HTTP_V2_CLIENT_CONNECTION_NORMAL_CONNECTION_DELEGATE_INC__
7-
#define __NETWORK_HTTP_V2_CLIENT_CONNECTION_NORMAL_CONNECTION_DELEGATE_INC__
6+
#ifndef __NETWORK_HTTP_V2_CLIENT_CONNECTION_NORMAL_CONNECTION_INC__
7+
#define __NETWORK_HTTP_V2_CLIENT_CONNECTION_NORMAL_CONNECTION_INC__
88

99
#include <boost/asio/ip/tcp.hpp>
1010
#include <boost/asio/io_service.hpp>
11-
#include <network/http/v2/client/connection/connection_delegate.hpp>
11+
#include <network/http/v2/client/connection/connection.hpp>
1212

1313
namespace network {
1414
namespace http {
1515
namespace v2 {
16-
class normal_connection_delegate : public connection_delegate {
16+
class normal_connection : public connection {
1717

18-
normal_connection_delegate(const normal_connection_delegate &) = delete;
19-
normal_connection_delegate &operator = (const normal_connection_delegate &) = delete;
18+
normal_connection(const normal_connection &) = delete;
19+
normal_connection &operator = (const normal_connection &) = delete;
2020

2121
public:
2222

23-
explicit normal_connection_delegate(boost::asio::io_service &io_service)
23+
explicit normal_connection(boost::asio::io_service &io_service)
2424
: io_service_(io_service) {
2525

2626
}
2727

28-
virtual ~normal_connection_delegate() noexcept {
28+
virtual ~normal_connection() noexcept {
2929

3030
}
3131

@@ -60,4 +60,4 @@ namespace network {
6060
} // namespace http
6161
} // namespace network
6262

63-
#endif // __NETWORK_HTTP_V2_CLIENT_CONNECTION_NORMAL_CONNECTION_DELEGATE_INC__
63+
#endif // __NETWORK_HTTP_V2_CLIENT_CONNECTION_NORMAL_CONNECTION_INC__

http/src/network/http/v2/client/connection/ssl_connection_delegate.hpp renamed to http/src/network/http/v2/client/connection/ssl_connection.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
// (See accompanying file LICENSE_1_0.txt or copy at
44
// http://www.boost.org/LICENSE_1_0.txt)
55

6-
#ifndef __NETWORK_HTTP_V2_CLIENT_CONNECTION_SSL_CONNECTION_DELEGATE_INC__
7-
#define __NETWORK_HTTP_V2_CLIENT_CONNECTION_SSL_CONNECTION_DELEGATE_INC__
6+
#ifndef __NETWORK_HTTP_V2_CLIENT_CONNECTION_SSL_CONNECTION_INC__
7+
#define __NETWORK_HTTP_V2_CLIENT_CONNECTION_SSL_CONNECTION_INC__
88

9-
#include "network/http/v2/client/connection/connection_delegate.hpp"
10-
#include "network/http/v2/client/client.hpp"
9+
#include <network/http/v2/client/connection/connection.hpp>
10+
#include <network/http/v2/client/client.hpp>
1111
#include <memory>
1212
#include <vector>
1313
#include <boost/asio/ip/tcp.hpp>
@@ -18,21 +18,21 @@
1818
namespace network {
1919
namespace http {
2020
namespace v2 {
21-
class ssl_connection_delegate
22-
: public connection_delegate, std::enable_shared_from_this<ssl_connection_delegate> {
21+
class ssl_connection
22+
: public connection, std::enable_shared_from_this<ssl_connection> {
2323

24-
ssl_connection_delegate(const ssl_connection_delegate &) = delete;
25-
ssl_connection_delegate &operator = (const ssl_connection_delegate &) = delete;
24+
ssl_connection(const ssl_connection &) = delete;
25+
ssl_connection &operator = (const ssl_connection &) = delete;
2626

2727
public:
2828

29-
ssl_connection_delegate(boost::asio::io_service &io_service, const client_options &options)
29+
ssl_connection(boost::asio::io_service &io_service, const client_options &options)
3030
: io_service_(io_service)
3131
, options_(options) {
3232

3333
}
3434

35-
virtual ~ssl_connection_delegate() noexcept {
35+
virtual ~ssl_connection() noexcept {
3636

3737
}
3838

@@ -94,4 +94,4 @@ namespace network {
9494
} // namespace http
9595
} // namespace network
9696

97-
#endif // __NETWORK_HTTP_V2_CLIENT_CONNECTION_SSL_CONNECTION_DELEGATE_INC__
97+
#endif // __NETWORK_HTTP_V2_CLIENT_CONNECTION_SSL_CONNECTION_INC__

http/test/v2/features/client/normal_connection_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <thread>
88
#include <igloo/igloo_alt.h>
99
#include <boost/asio.hpp>
10-
#include "network/http/v2/client/connection/normal_connection_delegate.hpp"
10+
#include "network/http/v2/client/connection/normal_connection.hpp"
1111
#include "network/http/v2/client/request.hpp"
1212

1313
using namespace igloo;
@@ -19,7 +19,7 @@ Describe(normal_http_connection) {
1919
void SetUp() {
2020
io_service_.reset(new boost::asio::io_service);
2121
resolver_.reset(new tcp::resolver(*io_service_));
22-
connection_.reset(new http::normal_connection_delegate(*io_service_));
22+
connection_.reset(new http::normal_connection(*io_service_));
2323
socket_.reset(new tcp::socket(*io_service_));
2424
}
2525

@@ -131,7 +131,7 @@ Describe(normal_http_connection) {
131131

132132
std::unique_ptr<boost::asio::io_service> io_service_;
133133
std::unique_ptr<tcp::resolver> resolver_;
134-
std::unique_ptr<http::connection_delegate> connection_;
134+
std::unique_ptr<http::connection> connection_;
135135
std::unique_ptr<tcp::socket> socket_;
136136

137137
};

0 commit comments

Comments
 (0)