Various fixes.
GitOrigin-RevId: da4869e5054952663ad5993f5770f2984a473818
This commit is contained in:
parent
8853c37fe2
commit
20503e04d2
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -29,9 +29,6 @@
|
|||||||
*.csproj text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
|
*.csproj text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
|
||||||
*.sln text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
|
*.sln text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
|
||||||
*.xml text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
|
*.xml text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
|
||||||
*.rb text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
|
|
||||||
*.lock text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
|
|
||||||
*.go text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
|
|
||||||
*.config text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
|
*.config text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
|
||||||
|
|
||||||
sqlite/sqlite/* linguist-vendored
|
sqlite/sqlite/* linguist-vendored
|
||||||
|
@ -1187,7 +1187,8 @@ void WebPagesManager::on_get_web_page_instant_view(WebPage *web_page, tl_object_
|
|||||||
if (photo.id == -2 || photo.id == 0) {
|
if (photo.id == -2 || photo.id == 0) {
|
||||||
LOG(ERROR) << "Receive empty photo in web page instant view for " << web_page->url;
|
LOG(ERROR) << "Receive empty photo in web page instant view for " << web_page->url;
|
||||||
} else {
|
} else {
|
||||||
photos.emplace(photo.id, std::move(photo));
|
auto photo_id = photo.id;
|
||||||
|
photos.emplace(photo_id, std::move(photo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (web_page->photo.id != -2 && web_page->photo.id != 0) {
|
if (web_page->photo.id != -2 && web_page->photo.id != 0) {
|
||||||
|
@ -51,7 +51,7 @@ target_include_directories(tdnet SYSTEM PRIVATE $<BUILD_INTERFACE:${OPENSSL_INCL
|
|||||||
target_link_libraries(tdnet PUBLIC tdutils tdactor PRIVATE ${CMAKE_DL_LIBS} ${ZLIB_LIBRARIES})
|
target_link_libraries(tdnet PUBLIC tdutils tdactor PRIVATE ${CMAKE_DL_LIBS} ${ZLIB_LIBRARIES})
|
||||||
target_link_libraries(tdnet PRIVATE ${OPENSSL_CRYPTO_LIBRARY})
|
target_link_libraries(tdnet PRIVATE ${OPENSSL_CRYPTO_LIBRARY})
|
||||||
if (NOT EMSCRIPTEN)
|
if (NOT EMSCRIPTEN)
|
||||||
target_link_libraries(tdnet PRIVATE ${OPENSSL_SSL_LIBRARY})
|
target_link_libraries(tdnet PRIVATE ${OPENSSL_SSL_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
|
@ -542,12 +542,15 @@ size_t SslStream::flow_write(Slice slice) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
#else
|
|
||||||
|
#else
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
class SslStreamImpl {
|
class SslStreamImpl {};
|
||||||
};
|
} // namespace detail
|
||||||
}
|
|
||||||
SslStream::SslStream() = default;
|
SslStream::SslStream() = default;
|
||||||
SslStream::SslStream(SslStream &&) = default;
|
SslStream::SslStream(SslStream &&) = default;
|
||||||
SslStream &SslStream::operator=(SslStream &&) = default;
|
SslStream &SslStream::operator=(SslStream &&) = default;
|
||||||
@ -556,20 +559,26 @@ SslStream::~SslStream() = default;
|
|||||||
Result<SslStream> SslStream::create(CSlice host, CSlice cert_file, VerifyPeer verify_peer) {
|
Result<SslStream> SslStream::create(CSlice host, CSlice cert_file, VerifyPeer verify_peer) {
|
||||||
return Status::Error("Not supported in emscripten");
|
return Status::Error("Not supported in emscripten");
|
||||||
}
|
}
|
||||||
|
|
||||||
SslStream::SslStream(unique_ptr<detail::SslStreamImpl> impl) : impl_(std::move(impl)) {
|
SslStream::SslStream(unique_ptr<detail::SslStreamImpl> impl) : impl_(std::move(impl)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteFlowInterface &SslStream::read_byte_flow() {
|
ByteFlowInterface &SslStream::read_byte_flow() {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteFlowInterface &SslStream::write_byte_flow() {
|
ByteFlowInterface &SslStream::write_byte_flow() {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t SslStream::flow_read(MutableSlice slice) {
|
size_t SslStream::flow_read(MutableSlice slice) {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t SslStream::flow_write(Slice slice) {
|
size_t SslStream::flow_write(Slice slice) {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -14,7 +14,7 @@ namespace td {
|
|||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
class SslStreamImpl;
|
class SslStreamImpl;
|
||||||
}
|
} // namespace detail
|
||||||
|
|
||||||
class SslStream {
|
class SslStream {
|
||||||
public:
|
public:
|
||||||
|
@ -238,7 +238,7 @@ class ConcurrentHashMap {
|
|||||||
TaskCreator task_creator;
|
TaskCreator task_creator;
|
||||||
|
|
||||||
void do_migrate(HashMap *ptr) {
|
void do_migrate(HashMap *ptr) {
|
||||||
//LOG(ERROR) << "do migrate: " << ptr;
|
//LOG(ERROR) << "In do_migrate: " << ptr;
|
||||||
std::unique_lock<std::mutex> lock(migrate_mutex_);
|
std::unique_lock<std::mutex> lock(migrate_mutex_);
|
||||||
if (hash_map_.load() != ptr) {
|
if (hash_map_.load() != ptr) {
|
||||||
return;
|
return;
|
||||||
@ -260,7 +260,7 @@ class ConcurrentHashMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void finish_migrate() {
|
void finish_migrate() {
|
||||||
//LOG(ERROR) << "finish_migrate";
|
//LOG(ERROR) << "In finish_migrate";
|
||||||
hash_map_.store(migrate_to_hash_map_);
|
hash_map_.store(migrate_to_hash_map_);
|
||||||
hp_.retire(get_thread_id(), migrate_from_hash_map_);
|
hp_.retire(get_thread_id(), migrate_from_hash_map_);
|
||||||
migrate_from_hash_map_ = nullptr;
|
migrate_from_hash_map_ = nullptr;
|
||||||
@ -273,7 +273,7 @@ class ConcurrentHashMap {
|
|||||||
if (migrate_from_hash_map_ != nullptr) {
|
if (migrate_from_hash_map_ != nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//LOG(ERROR) << "init_migrate";
|
//LOG(ERROR) << "In init_migrate";
|
||||||
CHECK(migrate_cnt_ == 0);
|
CHECK(migrate_cnt_ == 0);
|
||||||
migrate_generation_++;
|
migrate_generation_++;
|
||||||
migrate_from_hash_map_ = hash_map_.exchange(nullptr);
|
migrate_from_hash_map_ = hash_map_.exchange(nullptr);
|
||||||
@ -285,7 +285,7 @@ class ConcurrentHashMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void run_migrate() {
|
void run_migrate() {
|
||||||
//LOG(ERROR) << "run_migrate";
|
//LOG(ERROR) << "In run_migrate";
|
||||||
size_t cnt = 0;
|
size_t cnt = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
auto task = task_creator.create();
|
auto task = task_creator.create();
|
||||||
@ -295,7 +295,7 @@ class ConcurrentHashMap {
|
|||||||
}
|
}
|
||||||
run_task(task);
|
run_task(task);
|
||||||
}
|
}
|
||||||
//LOG(ERROR) << "run_migrate " << cnt;
|
//LOG(ERROR) << "In run_migrate " << cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void run_task(Task task) {
|
void run_task(Task task) {
|
||||||
@ -309,7 +309,7 @@ class ConcurrentHashMap {
|
|||||||
//LOG(ERROR) << node_key << " " << node_key;
|
//LOG(ERROR) << node_key << " " << node_key;
|
||||||
auto ok = migrate_to_hash_map_->with_value(
|
auto ok = migrate_to_hash_map_->with_value(
|
||||||
node_key, true, [&](auto &node_value) { node_value.store(old_value, std::memory_order_relaxed); });
|
node_key, true, [&](auto &node_value) { node_value.store(old_value, std::memory_order_relaxed); });
|
||||||
LOG_CHECK(ok) << "migration overflow";
|
LOG_CHECK(ok) << "Migration overflow";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -197,7 +197,7 @@ Result<FileFd> FileFd::open(CSlice filepath, int32 flags, int32 mode) {
|
|||||||
CreateFile(w_filepath.c_str(), desired_access, share_mode, nullptr, creation_disposition, native_flags, nullptr);
|
CreateFile(w_filepath.c_str(), desired_access, share_mode, nullptr, creation_disposition, native_flags, nullptr);
|
||||||
#else
|
#else
|
||||||
CREATEFILE2_EXTENDED_PARAMETERS extended_parameters;
|
CREATEFILE2_EXTENDED_PARAMETERS extended_parameters;
|
||||||
memset(&extended_parameters, 0, sizeof(extended_parameters));
|
std::memset(&extended_parameters, 0, sizeof(extended_parameters));
|
||||||
extended_parameters.dwFileFlags = native_flags;
|
extended_parameters.dwFileFlags = native_flags;
|
||||||
auto handle = CreateFile2(w_filepath.c_str(), desired_access, share_mode, creation_disposition, &extended_parameters);
|
auto handle = CreateFile2(w_filepath.c_str(), desired_access, share_mode, creation_disposition, &extended_parameters);
|
||||||
#endif
|
#endif
|
||||||
|
@ -56,7 +56,7 @@ class IocpRef {
|
|||||||
IocpRef(IocpRef &&) = default;
|
IocpRef(IocpRef &&) = default;
|
||||||
IocpRef &operator=(IocpRef &&) = default;
|
IocpRef &operator=(IocpRef &&) = default;
|
||||||
|
|
||||||
IocpRef(std::weak_ptr<NativeFd> iocp_handle);
|
explicit IocpRef(std::weak_ptr<NativeFd> iocp_handle);
|
||||||
|
|
||||||
bool post(size_t size, Iocp::Callback *callback, WSAOVERLAPPED *overlapped);
|
bool post(size_t size, Iocp::Callback *callback, WSAOVERLAPPED *overlapped);
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ static void default_failure_signal_handler(int sig) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Status set_default_failure_signal_handler() {
|
Status set_default_failure_signal_handler() {
|
||||||
atexit(block_stdin);
|
std::atexit(block_stdin);
|
||||||
TRY_STATUS(setup_signals_alt_stack());
|
TRY_STATUS(setup_signals_alt_stack());
|
||||||
TRY_STATUS(set_signal_handler(SignalType::Abort, default_failure_signal_handler));
|
TRY_STATUS(set_signal_handler(SignalType::Abort, default_failure_signal_handler));
|
||||||
TRY_STATUS(set_signal_handler(SignalType::Error, default_failure_signal_handler));
|
TRY_STATUS(set_signal_handler(SignalType::Error, default_failure_signal_handler));
|
||||||
|
@ -82,7 +82,7 @@ void print_backtrace_gdb(void) {
|
|||||||
#endif
|
#endif
|
||||||
dup2(2, 1); // redirect output to stderr
|
dup2(2, 1); // redirect output to stderr
|
||||||
execlp("gdb", "gdb", "--batch", "-n", "-ex", "thread", "-ex", "thread apply all bt full", name_buf, pid_buf_begin,
|
execlp("gdb", "gdb", "--batch", "-n", "-ex", "thread", "-ex", "thread apply all bt full", name_buf, pid_buf_begin,
|
||||||
NULL);
|
nullptr);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
#if TD_LINUX && defined(PR_SET_PTRACER)
|
#if TD_LINUX && defined(PR_SET_PTRACER)
|
||||||
|
@ -43,7 +43,7 @@ class ArrayHashMap {
|
|||||||
}
|
}
|
||||||
struct Node {
|
struct Node {
|
||||||
std::atomic<KeyT> key{KeyT{}};
|
std::atomic<KeyT> key{KeyT{}};
|
||||||
std::atomic<ValueT> value{};
|
std::atomic<ValueT> value{ValueT{}};
|
||||||
};
|
};
|
||||||
static std::string get_name() {
|
static std::string get_name() {
|
||||||
return "ArrayHashMap";
|
return "ArrayHashMap";
|
||||||
@ -188,7 +188,7 @@ class HashMapBenchmark : public td::Benchmark {
|
|||||||
|
|
||||||
size_t threads_n = 16;
|
size_t threads_n = 16;
|
||||||
int mod_;
|
int mod_;
|
||||||
constexpr static size_t mul_ = 7273; //1000000000 + 7;
|
static constexpr size_t mul_ = 7273; //1000000000 + 7;
|
||||||
int n_;
|
int n_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -235,7 +235,7 @@ class HashMapBenchmark : public td::Benchmark {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class HashMap>
|
template <class HashMap>
|
||||||
void bench_hash_map() {
|
static void bench_hash_map() {
|
||||||
td::bench(HashMapBenchmark<HashMap>(16));
|
td::bench(HashMapBenchmark<HashMap>(16));
|
||||||
td::bench(HashMapBenchmark<HashMap>(1));
|
td::bench(HashMapBenchmark<HashMap>(1));
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#if !TD_THREAD_UNSUPPORTED
|
#if !TD_THREAD_UNSUPPORTED
|
||||||
TEST(EpochBaseMemoryReclamation, stress) {
|
TEST(EpochBaseMemoryReclamation, stress) {
|
||||||
struct Node {
|
struct Node {
|
||||||
std::atomic<std::string *> name_;
|
std::atomic<std::string *> name_{nullptr};
|
||||||
char pad[64];
|
char pad[64];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -872,7 +872,7 @@ class ValueB {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <template <class T> class HashT>
|
template <template <class T> class HashT>
|
||||||
void test_hash() {
|
static void test_hash() {
|
||||||
// Just check that the following compiles
|
// Just check that the following compiles
|
||||||
AbslHashValue(Hasher(), ValueA{1});
|
AbslHashValue(Hasher(), ValueA{1});
|
||||||
HashT<ValueA>()(ValueA{1});
|
HashT<ValueA>()(ValueA{1});
|
||||||
|
@ -629,7 +629,6 @@ TEST(Mtproto, TlsTransport) {
|
|||||||
{
|
{
|
||||||
auto guard = sched.get_main_guard();
|
auto guard = sched.get_main_guard();
|
||||||
class RunTest : public Actor {
|
class RunTest : public Actor {
|
||||||
private:
|
|
||||||
void start_up() override {
|
void start_up() override {
|
||||||
class Callback : public TransparentProxy::Callback {
|
class Callback : public TransparentProxy::Callback {
|
||||||
public:
|
public:
|
||||||
|
Reference in New Issue
Block a user