Skip to content

Commit 0215a74

Browse files
committed
Fix handling of HTTP/S keep-alives (RIPD-556):
* Proper shutdown for ssl and non-ssl connections * Report session id in history * Report histogram of requests per session * Change print name to 'http' * Split logging into "HTTP" and "HTTP-RPC" partitions * More logging and refinement of logging severities * Log the request count when a session is destroyed
1 parent 79db0ca commit 0215a74

File tree

10 files changed

+494
-230
lines changed

10 files changed

+494
-230
lines changed

src/ripple/http/Session.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,15 @@ class Session
147147
}
148148
/** @} */
149149

150+
/** Detach the session.
151+
This holds the session open so that the response can be sent
152+
asynchronously. Calls to io_service::run made by the server
153+
will not return until all detached sessions are closed.
154+
*/
155+
virtual
156+
void
157+
detach() = 0;
158+
150159
/** Indicate that the response is complete.
151160
The handler should call this when it has completed writing
152161
the response. If Keep-Alive is indicated on the connection,
@@ -157,15 +166,6 @@ class Session
157166
void
158167
complete() = 0;
159168

160-
/** Detach the session.
161-
This holds the session open so that the response can be sent
162-
asynchronously. Calls to io_service::run made by the server
163-
will not return until all detached sessions are closed.
164-
*/
165-
virtual
166-
void
167-
detach() = 0;
168-
169169
/** Close the session.
170170
This will be performed asynchronously. The session will be
171171
closed gracefully after all pending writes have completed.

src/ripple/http/impl/Door.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void
8181
Door::async_accept ()
8282
{
8383
auto const peer (std::make_shared <Peer> (server_, port_, server_.journal()));
84-
acceptor_.async_accept (peer->get_socket(), std::bind (
84+
acceptor_.async_accept (peer->get_socket(), endpoint_, std::bind (
8585
&Door::handle_accept, Ptr(this),
8686
beast::asio::placeholders::error, peer));
8787
}
@@ -95,13 +95,14 @@ Door::handle_accept (error_code ec,
9595

9696
if (ec)
9797
{
98-
server_.journal().error << "Accept failed: " << ec.message();
98+
server_.journal().error <<
99+
"accept: " << ec.message();
99100
return;
100101
}
101102

103+
auto const endpoint = endpoint_;
102104
async_accept();
103-
104-
peer->accept();
105+
peer->accept (endpoint);
105106
}
106107

107108
}

src/ripple/http/impl/Door.h

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class Door
3939

4040
ServerImpl& server_;
4141
acceptor acceptor_;
42+
endpoint_t endpoint_;
4243
Port port_;
4344

4445
public:

0 commit comments

Comments
 (0)