mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
updated smartcontracts
- updated smartcontracts - updated fullnode database layout - fixed memory leak in blockchain-explorer - updated tonlib
This commit is contained in:
parent
9c9248a9ae
commit
c860ce3d1e
104 changed files with 7309 additions and 1335 deletions
|
@ -130,70 +130,6 @@ void UdpServerImpl::hangup_shared() {
|
|||
stop();
|
||||
}
|
||||
|
||||
class TcpInfiniteListener : public actor::Actor {
|
||||
public:
|
||||
TcpInfiniteListener(int32 port, std::unique_ptr<TcpListener::Callback> callback)
|
||||
: port_(port), callback_(std::move(callback)) {
|
||||
}
|
||||
|
||||
private:
|
||||
int32 port_;
|
||||
std::unique_ptr<TcpListener::Callback> callback_;
|
||||
actor::ActorOwn<TcpListener> tcp_listener_;
|
||||
int32 refcnt_{0};
|
||||
bool close_flag_{false};
|
||||
|
||||
void start_up() override {
|
||||
loop();
|
||||
}
|
||||
|
||||
void hangup() override {
|
||||
close_flag_ = true;
|
||||
tcp_listener_.reset();
|
||||
if (refcnt_ == 0) {
|
||||
stop();
|
||||
}
|
||||
}
|
||||
|
||||
void loop() override {
|
||||
if (!tcp_listener_.empty()) {
|
||||
return;
|
||||
}
|
||||
class Callback : public TcpListener::Callback {
|
||||
public:
|
||||
Callback(actor::ActorShared<TcpInfiniteListener> parent) : parent_(std::move(parent)) {
|
||||
}
|
||||
void accept(SocketFd fd) override {
|
||||
actor::send_closure(parent_, &TcpInfiniteListener::accept, std::move(fd));
|
||||
}
|
||||
|
||||
private:
|
||||
actor::ActorShared<TcpInfiniteListener> parent_;
|
||||
};
|
||||
VLOG(udp_server) << "Create listener";
|
||||
refcnt_++;
|
||||
tcp_listener_ = actor::create_actor<TcpListener>(
|
||||
actor::ActorOptions().with_name(PSLICE() << "TcpListener" << tag("port", port_)).with_poll(), port_,
|
||||
std::make_unique<Callback>(actor_shared(this)));
|
||||
}
|
||||
|
||||
void accept(SocketFd fd) {
|
||||
callback_->accept(std::move(fd));
|
||||
}
|
||||
|
||||
void hangup_shared() override {
|
||||
refcnt_--;
|
||||
tcp_listener_.reset();
|
||||
if (close_flag_) {
|
||||
if (refcnt_ == 0) {
|
||||
stop();
|
||||
}
|
||||
} else {
|
||||
alarm_timestamp() = Timestamp::in(5 /*5 seconds*/);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class TcpClient : public td::actor::Actor, td::ObserverBase {
|
||||
public:
|
||||
class Callback {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue