Skip to content

Commit b91743c

Browse files
committed
Merge branch '0.5-devel' of git://github.com/mikhailberis/cpp-netlib into 0.5-devel
2 parents 1109b01 + 5344fcf commit b91743c

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

boost/network/protocol/http/connection.hpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ namespace boost { namespace network { namespace http {
4545
, socket_(service_)
4646
, wrapper_(service_)
4747
{
48-
try {
49-
socket_.set_option(tcp::no_delay(true)); // Don't delay writing
50-
} catch (system::system_error & e) {
51-
handler_.log(e.what());
52-
}
5348
}
5449

5550
tcp::socket & socket() {
@@ -62,6 +57,9 @@ namespace boost { namespace network { namespace http {
6257
// and then pass that request object to the
6358
// handler_ instance.
6459
//
60+
boost::system::error_code option_error;
61+
socket_.set_option(tcp::no_delay(true), option_error);
62+
if (option_error) handler_.log(system::system_error(option_error).what());
6563
socket_.async_read_some(
6664
boost::asio::buffer(buffer_),
6765
wrapper_.wrap(

libs/network/test/hello_world.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,26 @@ namespace http = boost::network::http;
1616
using boost::assign::list_of;
1717
using boost::lexical_cast;
1818
using std::string;
19+
using std::cerr;
20+
using std::endl;
1921

2022
struct hello_world;
2123
typedef http::server<hello_world> server;
2224

2325
struct hello_world {
26+
2427
void operator()(server::request const & request, server::response & response) {
2528
response = server::response::stock_reply(server::response::ok, "Hello, World!");
2629
assert(response.status == server::response::ok);
2730
assert(response.headers.size() == 2);
2831
assert(response.content == "Hello, World!");
2932
}
30-
void log(...) {
31-
// do nothing
33+
34+
void log(string const & data) {
35+
cerr << data << endl;
36+
abort();
3237
}
38+
3339
};
3440

3541
int main(int argc, char * argv[]) {
@@ -38,3 +44,4 @@ int main(int argc, char * argv[]) {
3844
server_.run();
3945
return EXIT_SUCCESS;
4046
}
47+

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy