Skip to content

Commit bb42b4f

Browse files
committed
Fixed include guards.
1 parent 609ed29 commit bb42b4f

File tree

13 files changed

+89
-62
lines changed

13 files changed

+89
-62
lines changed

http/src/http/v2/client/client.cpp

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,32 @@ namespace network {
1717
namespace v2 {
1818
using boost::asio::ip::tcp;
1919

20-
struct request_helper {
20+
//struct request_helper {
21+
//
22+
// request_helper() {
23+
//
24+
// }
25+
//
26+
// client::string_type host_;
27+
// boost::asio::streambuf request_;
28+
// std::promise<response> response_promise_;
29+
// boost::asio::streambuf response_;
30+
//
31+
//};
32+
33+
struct resolve_helper {
2134

22-
request_helper(boost::asio::io_service &io_service) {
35+
};
2336

24-
}
37+
struct connect_helper {
2538

26-
boost::asio::streambuf request_;
27-
std::promise<response> response_promise_;
28-
boost::asio::streambuf response_;
39+
};
40+
41+
struct request_helper {
42+
43+
};
44+
45+
struct response_helper {
2946

3047
};
3148

@@ -35,13 +52,17 @@ namespace network {
3552

3653
~impl() NETWORK_NOEXCEPT;
3754

38-
void connect(const boost::system::error_code &ec);
55+
void connect(client::string_type host,
56+
const boost::system::error_code &ec,
57+
tcp::resolver::iterator endpoint_iterator);
3958

40-
void write_request(const boost::system::error_code &ec, std::size_t bytes_written);
59+
void write_request(const boost::system::error_code &ec);
4160

42-
void read_response_status(const boost::system::error_code &ec, std::size_t bytes_written);
61+
void read_response_status(const boost::system::error_code &ec,
62+
std::size_t bytes_written);
4363

44-
void read_response_headers(const boost::system::error_code &ec, std::size_t bytes_written);
64+
void read_response_headers(const boost::system::error_code &ec,
65+
std::size_t bytes_read);
4566

4667
std::future<response> do_request(method method_, request request_, request_options options);
4768

@@ -75,19 +96,25 @@ namespace network {
7596
lifetime_thread_.join();
7697
}
7798

78-
void client::impl::connect(const boost::system::error_code &ec) {
99+
void client::impl::connect(client::string_type host,
100+
const boost::system::error_code &ec,
101+
tcp::resolver::iterator endpoint_iterator) {
79102
if (ec) {
80103
return;
81104
}
82105

83-
// endpoint!
84-
// host!
106+
if (endpoint_iterator == tcp::resolver::iterator()) {
107+
return;
108+
}
85109

86-
//connection_.async_connect(endpoint, reques
110+
tcp::endpoint endpoint(*endpoint_iterator);
111+
connection_.async_connect(endpoint, host,
112+
[=] (const boost::system::error_code &ec) {
113+
write_request(ec);
114+
});
87115
}
88116

89-
void client::impl::write_request(const boost::system::error_code &ec,
90-
std::size_t bytes_written) {
117+
void client::impl::write_request(const boost::system::error_code &ec) {
91118
if (ec) {
92119
return;
93120
}
@@ -96,7 +123,7 @@ namespace network {
96123
}
97124

98125
void client::impl::read_response_status(const boost::system::error_code &ec,
99-
std::size_t bytes_read) {
126+
std::size_t) {
100127
if (ec) {
101128
return;
102129
}
@@ -105,7 +132,7 @@ namespace network {
105132
}
106133

107134
void client::impl::read_response_headers(const boost::system::error_code &ec,
108-
std::size_t bytes_read) {
135+
std::size_t) {
109136
if (ec) {
110137
return;
111138
}
@@ -123,17 +150,17 @@ namespace network {
123150
request_stream << req;
124151
if (!request_stream) {
125152
// set error
153+
//response_promise_.set_value(response());
126154
return response;
127155
}
128156

129-
//auto endpoints = resolver_.async_resolve(req.host(), req.port(),
130-
// [=](const boost::system::error_code &ec) {
131-
// if (ec) {
132-
// // promise set error
133-
// return;
134-
// }
135-
// this->connect(ec);
136-
// });
157+
//
158+
159+
auto endpoints = resolver_.async_resolve(req.host(), req.port(),
160+
[=](const boost::system::error_code &ec,
161+
tcp::resolver::iterator endpoint_iterator) {
162+
this->connect(ec, endpoint_iterator);
163+
});
137164

138165
return response;
139166
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
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_INC__
7-
#define __NETWORK_HTTP_V2_CLIENT_INC__
6+
#ifndef NETWORK_HTTP_V2_CLIENT_INC
7+
#define NETWORK_HTTP_V2_CLIENT_INC
88

99
/**
1010
* \defgroup http_client HTTP Client
1111
*/
1212

1313
#include <network/http/v2/client/client.hpp>
1414

15-
#endif // __NETWORK_HTTP_V2_CLIENT_INC__
15+
#endif // NETWORK_HTTP_V2_CLIENT_INC

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
* \brief An HTTP client and configuration options.
1111
*/
1212

13-
#ifndef __NETWORK_HTTP_V2_CLIENT_CLIENT_INC__
14-
#define __NETWORK_HTTP_V2_CLIENT_CLIENT_INC__
13+
#ifndef NETWORK_HTTP_V2_CLIENT_CLIENT_INC
14+
#define NETWORK_HTTP_V2_CLIENT_CLIENT_INC
1515

1616
#include <future>
1717
#include <memory>
@@ -313,4 +313,4 @@ namespace network {
313313
} // namespace http
314314
} // namespace network
315315

316-
#endif // __NETWORK_HTTP_V2_CLIENT_CLIENT_INC__
316+
#endif // NETWORK_HTTP_V2_CLIENT_CLIENT_INC

http/src/network/http/v2/client/client_errors.hpp

Lines changed: 3 additions & 3 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_CLIENT_ERRORS_INC__
7-
#define __NETWORK_HTTP_V2_CLIENT_CLIENT_ERRORS_INC__
6+
#ifndef NETWORK_HTTP_V2_CLIENT_CLIENT_ERRORS_INC
7+
#define NETWORK_HTTP_V2_CLIENT_CLIENT_ERRORS_INC
88

99
/**
1010
* \file
@@ -139,4 +139,4 @@ namespace network {
139139
} // namespace http
140140
} // namespace network
141141

142-
#endif // __NETWORK_HTTP_V2_CLIENT_CLIENT_ERRORS_INC__
142+
#endif // NETWORK_HTTP_V2_CLIENT_CLIENT_ERRORS_INC

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

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

8-
#ifndef __NETWORK_HTTP_V2_CLIENT_CONNECTION_ASYNC_RESOLVER_INC__
9-
#define __NETWORK_HTTP_V2_CLIENT_CONNECTION_ASYNC_RESOLVER_INC__
8+
#ifndef NETWORK_HTTP_V2_CLIENT_CONNECTION_ASYNC_RESOLVER_INC
9+
#define NETWORK_HTTP_V2_CLIENT_CONNECTION_ASYNC_RESOLVER_INC
1010

1111
#include <stdexcept>
1212
#include <cstdint>
@@ -117,4 +117,4 @@ namespace network {
117117
} // namespace http
118118
} // namespace network
119119

120-
#endif // __NETWORK_HTTP_V2_CLIENT_CONNECTION_ASYNC_RESOLVER_INC__
120+
#endif // NETWORK_HTTP_V2_CLIENT_CONNECTION_ASYNC_RESOLVER_INC

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

Lines changed: 3 additions & 3 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_INC__
7-
#define __NETWORK_HTTP_V2_CLIENT_CONNECTION_CONNECTION_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>
@@ -89,4 +89,4 @@ namespace network {
8989
} // namespace http
9090
} // namespace network
9191

92-
#endif // __NETWORK_HTTP_V2_CLIENT_CONNECTION_CONNECTION_INC__
92+
#endif // NETWORK_HTTP_V2_CLIENT_CONNECTION_CONNECTION_INC

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

Lines changed: 3 additions & 3 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_NORMAL_CONNECTION_INC__
7-
#define __NETWORK_HTTP_V2_CLIENT_CONNECTION_NORMAL_CONNECTION_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/write.hpp>
1010
#include <boost/asio/read_until.hpp>
@@ -64,4 +64,4 @@ namespace network {
6464
} // namespace http
6565
} // namespace network
6666

67-
#endif // __NETWORK_HTTP_V2_CLIENT_CONNECTION_NORMAL_CONNECTION_INC__
67+
#endif // NETWORK_HTTP_V2_CLIENT_CONNECTION_NORMAL_CONNECTION_INC

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

Lines changed: 3 additions & 3 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_SSL_CONNECTION_INC__
7-
#define __NETWORK_HTTP_V2_CLIENT_CONNECTION_SSL_CONNECTION_INC__
6+
#ifndef NETWORK_HTTP_V2_CLIENT_CONNECTION_SSL_CONNECTION_INC
7+
#define NETWORK_HTTP_V2_CLIENT_CONNECTION_SSL_CONNECTION_INC
88

99
#include <memory>
1010
#include <vector>
@@ -95,4 +95,4 @@ namespace network {
9595
} // namespace http
9696
} // namespace network
9797

98-
#endif // __NETWORK_HTTP_V2_CLIENT_CONNECTION_SSL_CONNECTION_INC__
98+
#endif // NETWORK_HTTP_V2_CLIENT_CONNECTION_SSL_CONNECTION_INC

http/src/network/http/v2/client/request.hpp

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

8-
#ifndef __NETWORK_HTTP_V2_CLIENT_REQUEST_INC__
9-
#define __NETWORK_HTTP_V2_CLIENT_REQUEST_INC__
8+
#ifndef NETWORK_HTTP_V2_CLIENT_REQUEST_INC
9+
#define NETWORK_HTTP_V2_CLIENT_REQUEST_INC
1010

1111
/**
1212
* \file
@@ -419,4 +419,4 @@ namespace network {
419419
} // namespace http
420420
} // namespace network
421421

422-
#endif // __NETWORK_HTTP_V2_CLIENT_REQUEST_INC__
422+
#endif // NETWORK_HTTP_V2_CLIENT_REQUEST_INC

http/src/network/http/v2/client/response.hpp

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

8-
#ifndef __NETWORK_HTTP_V2_CLIENT_RESPONSE_INC__
9-
#define __NETWORK_HTTP_V2_CLIENT_RESPONSE_INC__
8+
#ifndef NETWORK_HTTP_V2_CLIENT_RESPONSE_INC
9+
#define NETWORK_HTTP_V2_CLIENT_RESPONSE_INC
1010

1111
#include <cstdint>
1212
#include <vector>
@@ -160,4 +160,4 @@ namespace network {
160160
} // namespace http
161161
} // namespace network
162162

163-
#endif // __NETWORK_HTTP_V2_CLIENT_RESPONSE_INC__
163+
#endif // NETWORK_HTTP_V2_CLIENT_RESPONSE_INC

0 commit comments

Comments
 (0)