Update TDLib.

This commit is contained in:
levlam 2021-09-29 20:34:21 +03:00
parent 36b0c4426a
commit 997a7408c7
4 changed files with 12 additions and 10 deletions

2
td

@ -1 +1 @@
Subproject commit 0126cec2686e3b95cc1b6dfb5676d364da0e091b
Subproject commit 0208b7058b1c092dc1b5f9a7509359d36a48ba8c

View File

@ -11,6 +11,7 @@
#include "td/net/HttpInboundConnection.h"
#include "td/net/TcpListener.h"
#include "td/utils/BufferedFd.h"
#include "td/utils/FloodControlFast.h"
#include "td/utils/format.h"
#include "td/utils/logging.h"
@ -64,8 +65,8 @@ class HttpServer : public td::TcpListener::Callback {
if (scheduler_id > 0) {
scheduler_id--;
}
td::create_actor<td::HttpInboundConnection>("HttpInboundConnection", std::move(fd), 0, 20, 500, creator_(),
scheduler_id)
td::create_actor<td::HttpInboundConnection>("HttpInboundConnection", td::BufferedFd<td::SocketFd>(std::move(fd)), 0,
20, 500, creator_(), scheduler_id)
.release();
}

View File

@ -156,7 +156,7 @@ td::Status WebhookActor::create_connection() {
public:
Callback(td::ActorId<WebhookActor> actor, td::int64 id) : actor_(actor), id_(id) {
}
void set_result(td::Result<td::SocketFd> result) override {
void set_result(td::Result<td::BufferedFd<td::SocketFd>> result) override {
send_closure(std::move(actor_), &WebhookActor::on_socket_ready_async, std::move(result), id_);
CHECK(actor_.empty());
}
@ -195,7 +195,7 @@ td::Status WebhookActor::create_connection() {
on_error(r_fd.move_as_error());
return error;
}
return create_connection(r_fd.move_as_ok());
return create_connection(td::BufferedFd<td::SocketFd>(r_fd.move_as_ok()));
}
td::Result<td::SslStream> WebhookActor::create_ssl_stream() {
@ -215,7 +215,7 @@ td::Result<td::SslStream> WebhookActor::create_ssl_stream() {
return r_ssl_stream.move_as_ok();
}
td::Status WebhookActor::create_connection(td::SocketFd fd) {
td::Status WebhookActor::create_connection(td::BufferedFd<td::SocketFd> fd) {
TRY_RESULT(ssl_stream, create_ssl_stream());
auto id = connections_.create(Connection());
@ -237,7 +237,7 @@ td::Status WebhookActor::create_connection(td::SocketFd fd) {
return td::Status::OK();
}
void WebhookActor::on_socket_ready_async(td::Result<td::SocketFd> r_fd, td::int64 id) {
void WebhookActor::on_socket_ready_async(td::Result<td::BufferedFd<td::SocketFd>> r_fd, td::int64 id) {
pending_sockets_.erase(id);
if (r_fd.is_ok()) {
VLOG(webhook) << "Socket " << id << " is ready";

View File

@ -17,6 +17,7 @@
#include "td/actor/actor.h"
#include "td/actor/PromiseFuture.h"
#include "td/utils/BufferedFd.h"
#include "td/utils/common.h"
#include "td/utils/Container.h"
#include "td/utils/FloodControlFast.h"
@ -159,7 +160,7 @@ class WebhookActor : public td::HttpOutboundConnection::Callback {
}
};
td::Container<td::ActorOwn<>> pending_sockets_;
td::vector<td::SocketFd> ready_sockets_;
td::vector<td::BufferedFd<td::SocketFd>> ready_sockets_;
td::int32 max_connections_ = 0;
td::Container<Connection> connections_;
@ -176,8 +177,8 @@ class WebhookActor : public td::HttpOutboundConnection::Callback {
td::Result<td::SslStream> create_ssl_stream();
td::Status create_connection() TD_WARN_UNUSED_RESULT;
td::Status create_connection(td::SocketFd fd) TD_WARN_UNUSED_RESULT;
void on_socket_ready_async(td::Result<td::SocketFd> r_fd, td::int64 id);
td::Status create_connection(td::BufferedFd<td::SocketFd> fd) TD_WARN_UNUSED_RESULT;
void on_socket_ready_async(td::Result<td::BufferedFd<td::SocketFd>> r_fd, td::int64 id);
void create_new_connections();