1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

updated liteserver

- new methods for liteserver/liteclient
- added ADNL/DHT client-only work mode
- fixed crash in ADNL
This commit is contained in:
ton 2020-02-02 16:53:37 +04:00
parent acf16718e6
commit 53ec9684bd
70 changed files with 816 additions and 322 deletions

View file

@ -504,6 +504,13 @@ void ArchiveManager::load_package(PackageId id) {
return;
}
std::string prefix = PSTRING() << db_root_ << id.path() << id.name();
auto f = td::FileFd::open(prefix + ".pack", td::FileFd::Read);
if (f.is_error()) {
x->deleted_ = true;
return;
}
FileDescription desc{id, false};
if (!id.temp) {
for (auto &e : x->firstblocks_) {
@ -512,7 +519,6 @@ void ArchiveManager::load_package(PackageId id) {
}
}
std::string prefix = PSTRING() << db_root_ << id.path() << id.name();
desc.file = td::actor::create_actor<ArchiveSlice>("slice", id.key, id.temp, prefix);
get_file_map(id).emplace(id, std::move(desc));

View file

@ -28,6 +28,7 @@ class PackageReader : public td::actor::Actor {
}
void start_up() {
promise_.set_result(package_->read(offset_));
stop();
}
private:

View file

@ -46,8 +46,14 @@ td::uint64 Package::append(std::string filename, td::Slice data, bool sync) {
size += 8;
CHECK(fd_.pwrite(filename, size).move_as_ok() == filename.size());
size += filename.size();
CHECK(fd_.pwrite(data, size).move_as_ok() == data.size());
size += data.size();
while (data.size() != 0) {
auto R = fd_.pwrite(data, size);
R.ensure();
auto x = R.move_as_ok();
CHECK(x > 0);
size += x;
data.remove_prefix(x);
}
if (sync) {
fd_.sync().ensure();
}