aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--benchmark/bench_http.cpp2
-rw-r--r--benchmark/bench_http_server.cpp4
-rw-r--r--benchmark/bench_http_server_cheat.cpp4
-rw-r--r--benchmark/bench_http_server_fast.cpp2
-rw-r--r--tdnet/td/net/HttpConnectionBase.cpp2
-rw-r--r--tdnet/td/net/HttpConnectionBase.h2
-rw-r--r--tdnet/td/net/HttpInboundConnection.cpp5
-rw-r--r--tdnet/td/net/HttpInboundConnection.h2
-rw-r--r--tdnet/td/net/HttpOutboundConnection.h4
-rw-r--r--tdnet/td/net/Wget.cpp8
10 files changed, 17 insertions, 18 deletions
diff --git a/benchmark/bench_http.cpp b/benchmark/bench_http.cpp
index 7650073e4..5fc8ba1f3 100644
--- a/benchmark/bench_http.cpp
+++ b/benchmark/bench_http.cpp
@@ -30,7 +30,7 @@ class HttpClient final : public HttpOutboundConnection::Callback {
addr.init_ipv4_port("127.0.0.1", 8082).ensure();
auto fd = SocketFd::open(addr);
LOG_CHECK(fd.is_ok()) << fd.error();
- connection_ = create_actor<HttpOutboundConnection>("Connect", fd.move_as_ok(), SslStream{},
+ connection_ = create_actor<HttpOutboundConnection>("Connect", BufferedFd<SocketFd>(fd.move_as_ok()), SslStream{},
std::numeric_limits<size_t>::max(), 0, 0,
ActorOwn<HttpOutboundConnection::Callback>(actor_id(this)));
yield();
diff --git a/benchmark/bench_http_server.cpp b/benchmark/bench_http_server.cpp
index 82aed1914..4351f03a5 100644
--- a/benchmark/bench_http_server.cpp
+++ b/benchmark/bench_http_server.cpp
@@ -56,8 +56,8 @@ class Server final : public TcpListener::Callback {
LOG(ERROR) << "ACCEPT " << cnt++;
pos_++;
auto scheduler_id = pos_ % (N != 0 ? N : 1) + (N != 0);
- create_actor_on_scheduler<HttpInboundConnection>("HttpInboundConnection", scheduler_id, std::move(fd), 1024 * 1024,
- 0, 0,
+ create_actor_on_scheduler<HttpInboundConnection>("HttpInboundConnection", scheduler_id,
+ BufferedFd<SocketFd>(std::move(fd)), 1024 * 1024, 0, 0,
create_actor_on_scheduler<HelloWorld>("HelloWorld", scheduler_id))
.release();
}
diff --git a/benchmark/bench_http_server_cheat.cpp b/benchmark/bench_http_server_cheat.cpp
index 1c3455aba..307f8e3a1 100644
--- a/benchmark/bench_http_server_cheat.cpp
+++ b/benchmark/bench_http_server_cheat.cpp
@@ -5,7 +5,6 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include "td/net/HttpHeaderCreator.h"
-#include "td/net/HttpInboundConnection.h"
#include "td/net/TcpListener.h"
#include "td/actor/actor.h"
@@ -22,7 +21,6 @@
namespace td {
-// HttpInboundConnection header
static int cnt = 0;
class HelloWorld final : public Actor {
public:
@@ -107,7 +105,7 @@ class Server final : public TcpListener::Callback {
LOG(ERROR) << "ACCEPT " << cnt++;
pos_++;
auto scheduler_id = pos_ % (N != 0 ? N : 1) + (N != 0);
- create_actor_on_scheduler<HelloWorld>("HttpInboundConnection", scheduler_id, std::move(fd)).release();
+ create_actor_on_scheduler<HelloWorld>("HelloWorld", scheduler_id, std::move(fd)).release();
}
void hangup() final {
// may be it should be default?..
diff --git a/benchmark/bench_http_server_fast.cpp b/benchmark/bench_http_server_fast.cpp
index d0a0e115b..28881160e 100644
--- a/benchmark/bench_http_server_fast.cpp
+++ b/benchmark/bench_http_server_fast.cpp
@@ -93,7 +93,7 @@ class Server final : public TcpListener::Callback {
void accept(SocketFd fd) final {
pos_++;
auto scheduler_id = pos_ % (N != 0 ? N : 1) + (N != 0);
- create_actor_on_scheduler<HttpEchoConnection>("HttpInboundConnection", scheduler_id, std::move(fd)).release();
+ create_actor_on_scheduler<HttpEchoConnection>("HttpEchoConnection", scheduler_id, std::move(fd)).release();
}
void hangup() final {
LOG(ERROR) << "Hanging up..";
diff --git a/tdnet/td/net/HttpConnectionBase.cpp b/tdnet/td/net/HttpConnectionBase.cpp
index ff61ee9ab..e95055599 100644
--- a/tdnet/td/net/HttpConnectionBase.cpp
+++ b/tdnet/td/net/HttpConnectionBase.cpp
@@ -16,7 +16,7 @@
namespace td {
namespace detail {
-HttpConnectionBase::HttpConnectionBase(State state, SocketFd fd, SslStream ssl_stream, size_t max_post_size,
+HttpConnectionBase::HttpConnectionBase(State state, BufferedFd<SocketFd> fd, SslStream ssl_stream, size_t max_post_size,
size_t max_files, int32 idle_timeout, int32 slow_scheduler_id)
: state_(state)
, fd_(std::move(fd))
diff --git a/tdnet/td/net/HttpConnectionBase.h b/tdnet/td/net/HttpConnectionBase.h
index f77add381..3d8f7ceba 100644
--- a/tdnet/td/net/HttpConnectionBase.h
+++ b/tdnet/td/net/HttpConnectionBase.h
@@ -32,7 +32,7 @@ class HttpConnectionBase : public Actor {
protected:
enum class State { Read, Write, Close };
- HttpConnectionBase(State state, SocketFd fd, SslStream ssl_stream, size_t max_post_size, size_t max_files,
+ HttpConnectionBase(State state, BufferedFd<SocketFd> fd, SslStream ssl_stream, size_t max_post_size, size_t max_files,
int32 idle_timeout, int32 slow_scheduler_id);
private:
diff --git a/tdnet/td/net/HttpInboundConnection.cpp b/tdnet/td/net/HttpInboundConnection.cpp
index c1189dc09..45459d503 100644
--- a/tdnet/td/net/HttpInboundConnection.cpp
+++ b/tdnet/td/net/HttpInboundConnection.cpp
@@ -12,8 +12,9 @@
namespace td {
-HttpInboundConnection::HttpInboundConnection(SocketFd fd, size_t max_post_size, size_t max_files, int32 idle_timeout,
- ActorShared<Callback> callback, int32 slow_scheduler_id)
+HttpInboundConnection::HttpInboundConnection(BufferedFd<SocketFd> fd, size_t max_post_size, size_t max_files,
+ int32 idle_timeout, ActorShared<Callback> callback,
+ int32 slow_scheduler_id)
: HttpConnectionBase(State::Read, std::move(fd), SslStream(), max_post_size, max_files, idle_timeout,
slow_scheduler_id)
, callback_(std::move(callback)) {
diff --git a/tdnet/td/net/HttpInboundConnection.h b/tdnet/td/net/HttpInboundConnection.h
index f0079534e..31e2633bf 100644
--- a/tdnet/td/net/HttpInboundConnection.h
+++ b/tdnet/td/net/HttpInboundConnection.h
@@ -27,7 +27,7 @@ class HttpInboundConnection final : public detail::HttpConnectionBase {
// void write_ok();
// void write_error(Status error);
- HttpInboundConnection(SocketFd fd, size_t max_post_size, size_t max_files, int32 idle_timeout,
+ HttpInboundConnection(BufferedFd<SocketFd> fd, size_t max_post_size, size_t max_files, int32 idle_timeout,
ActorShared<Callback> callback, int32 slow_scheduler_id = -1);
private:
diff --git a/tdnet/td/net/HttpOutboundConnection.h b/tdnet/td/net/HttpOutboundConnection.h
index 1440a05e2..900489026 100644
--- a/tdnet/td/net/HttpOutboundConnection.h
+++ b/tdnet/td/net/HttpOutboundConnection.h
@@ -24,8 +24,8 @@ class HttpOutboundConnection final : public detail::HttpConnectionBase {
virtual void handle(unique_ptr<HttpQuery> query) = 0;
virtual void on_connection_error(Status error) = 0; // TODO rename to on_error
};
- HttpOutboundConnection(SocketFd fd, SslStream ssl_stream, size_t max_post_size, size_t max_files, int32 idle_timeout,
- ActorShared<Callback> callback, int32 slow_scheduler_id = -1)
+ HttpOutboundConnection(BufferedFd<SocketFd> fd, SslStream ssl_stream, size_t max_post_size, size_t max_files,
+ int32 idle_timeout, ActorShared<Callback> callback, int32 slow_scheduler_id = -1)
: HttpConnectionBase(HttpConnectionBase::State::Write, std::move(fd), std::move(ssl_stream), max_post_size,
max_files, idle_timeout, slow_scheduler_id)
, callback_(std::move(callback)) {
diff --git a/tdnet/td/net/Wget.cpp b/tdnet/td/net/Wget.cpp
index 1da982f80..6873aca0e 100644
--- a/tdnet/td/net/Wget.cpp
+++ b/tdnet/td/net/Wget.cpp
@@ -79,14 +79,14 @@ Status Wget::try_init() {
return Status::Error("Sockets are not supported");
}
if (url.protocol_ == HttpUrl::Protocol::Http) {
- connection_ = create_actor<HttpOutboundConnection>("Connect", std::move(fd), SslStream{},
+ connection_ = create_actor<HttpOutboundConnection>("Connect", BufferedFd<SocketFd>(std::move(fd)), SslStream{},
std::numeric_limits<std::size_t>::max(), 0, 0,
ActorOwn<HttpOutboundConnection::Callback>(actor_id(this)));
} else {
TRY_RESULT(ssl_stream, SslStream::create(url.host_, CSlice() /* certificate */, verify_peer_));
- connection_ = create_actor<HttpOutboundConnection>("Connect", std::move(fd), std::move(ssl_stream),
- std::numeric_limits<std::size_t>::max(), 0, 0,
- ActorOwn<HttpOutboundConnection::Callback>(actor_id(this)));
+ connection_ = create_actor<HttpOutboundConnection>(
+ "Connect", BufferedFd<SocketFd>(std::move(fd)), std::move(ssl_stream), std::numeric_limits<std::size_t>::max(),
+ 0, 0, ActorOwn<HttpOutboundConnection::Callback>(actor_id(this)));
}
send_closure(connection_, &HttpOutboundConnection::write_next, BufferSlice(header));