42milez / starnetwork Goto Github PK
View Code? Open in Web Editor NEWA simple implementation of the star network.
A simple implementation of the star network.
For instance:
app/network.cc
ERR_CONTINUE(event->PayloadLength() < 8);
if (receiver_id == 1)
...
else if (receiver_id == 0) {
...
In the code below, since receiver_id
is declared as uint32_t
, this block will be never activated.
network.cc: 325
else if (receiver_id < 0) {
for (const auto &[id, peer] : peers_) {
// do not resend to self, also do not send to excluded
if (id == sender_id || id == -receiver_id) {
continue;
}
peer->Send(event->Channel(), payload.segment, nullptr);
}
if (-receiver_id != 1) {
payloads_.push_back(payload);
}
}
==507==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x7547ff in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<Catch::IReporterFactory> >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<Catch::IReporterFactory> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<Catch::IReporterFactory> > > >::_M_get_insert_unique_pos(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_tree.h:2035:7
#1 0x754077 in std::pair<std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<Catch::IReporterFactory> > >, bool> std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<Catch::IReporterFactory> >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<Catch::IReporterFactory> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<Catch::IReporterFactory> > > >::_M_emplace_unique<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<Catch::IReporterFactory> const&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<Catch::IReporterFactory> const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_tree.h:2356:19
#2 0x594fcb in std::pair<std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<Catch::IReporterFactory> > >, bool> std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<Catch::IReporterFactory>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<Catch::IReporterFactory> > > >::emplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<Catch::IReporterFactory> const&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<Catch::IReporterFactory> const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_map.h:569:16
#3 0x4ddae5 in Catch::ReporterRegistry::registerReporter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<Catch::IReporterFactory> const&) /root/.conan/data/Catch2/2.11.1/catchorg/stable/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/catch2/catch.hpp:12401:21
#4 0x5787fa in Catch::(anonymous namespace)::RegistryHub::registerReporter(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<Catch::IReporterFactory> const&) /root/.conan/data/Catch2/2.11.1/catchorg/stable/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/catch2/catch.hpp:12338:36
#5 0x5b39e8 in Catch::ReporterRegistrar<Catch::ConsoleReporter>::ReporterRegistrar(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /root/.conan/data/Catch2/2.11.1/catchorg/stable/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/catch2/catch.hpp:6001:37
#6 0x42629c in __cxx_global_var_init.276 /root/.conan/data/Catch2/2.11.1/catchorg/stable/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/catch2/catch.hpp:16461:1
#7 0x426757 in _GLOBAL__sub_I_main.cc /var/app/test/main.cc
#8 0xad087c in __libc_csu_init (/var/app/cmake-build-test-msan/bin/all_tests+0xad087c)
#9 0x7fbb8c188b27 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:266
#10 0x4281b9 in _start (/var/app/cmake-build-test-msan/bin/all_tests+0x4281b9)
SUMMARY: MemorySanitizer: use-of-uninitialized-value /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/stl_tree.h:2035:7 in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<Catch::IReporterFactory> >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<Catch::IReporterFactory> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<Catch::IReporterFactory> > > >::_M_get_insert_unique_pos(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
test with address sanitizer
https://app.circleci.com/pipelines/github/42milez/p2p-techdemo/339/workflows/6d8394c7-e637-415d-a370-08b884fc1a8d/jobs/1065
test with thread sanitizer
https://app.circleci.com/pipelines/github/42milez/p2p-techdemo/339/workflows/6d8394c7-e637-415d-a370-08b884fc1a8d/jobs/1066
lib/rudp/buffer.h
std::vector<uint8_t>::iterator
CopyTo(std::vector<uint8_t>::iterator it);
In the current RUDP implementation, host peer doesn't notify a new connection approved to peers already connected. For that reason, host peer will have lots of traffic. To reduce the traffic of host peer, notify the detail of a new peer to another peers and make a peer send own message to other peers.
need to run test longer?
running the command below:
docker-compose -f docker-compose.dev.yml run --rm analyze
and then the messege below is displayed:
[kernel.kallsyms] with build id e87cc9032a69b3937dc82a1bceb7ac42e7069c2a not found, continuing without symbols
Notes:
The role of kernel.kallsyms in a C++ application running
In worker thread, spdlog cannot work when optimization level is O1 or higher.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.