mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-20 08:30:35 +00:00
message: Fix passing by reference
From Avi: ''' start() returns immediately, then the listen object is destroyed (it is on the stack), then the lambda runs. [&] is also very dangerous. ''' This fixes a bug in initialization of messaging_service. [asias@hjpc urchin]$ ./message --listen-address 127.0.0.100 listen =127.0.0.100 protocol::server::server: addr=127.0.0.100:7000 opts.reuse_address=1, _reuseport=1 messaging_service on cpu_id=0, ip=127.0.0.100, listen_address=127.0.0.100 protocol::server::server: addr=0.36.145.24:7000 opts.reuse_address=1, _reuseport=1 messaging_service on cpu_id=1, ip=0.36.145.24, listen_address=0.36.145.24 Messaging server listening on port 7000 ...
This commit is contained in:
@@ -175,11 +175,10 @@ int main(int ac, char ** av) {
|
||||
("server", bpo::value<std::string>(), "Server ip")
|
||||
("listen-address", bpo::value<std::string>()->default_value("0.0.0.0"), "IP address to listen")
|
||||
("cpuid", bpo::value<uint32_t>()->default_value(0), "Server cpuid");
|
||||
return app.run(ac, av, [&] {
|
||||
auto&& config = app.configuration();
|
||||
auto listen = gms::inet_address(config["listen-address"].as<std::string>());
|
||||
net::get_messaging_service().start(std::ref(listen)).then([&] () {
|
||||
auto&& config = app.configuration();
|
||||
return app.run(ac, av, [&app] {
|
||||
auto config = app.configuration();
|
||||
const gms::inet_address listen = gms::inet_address(config["listen-address"].as<std::string>());
|
||||
net::get_messaging_service().start(listen).then([config] () {
|
||||
auto testers = new distributed<tester>;
|
||||
testers->start().then([testers]{
|
||||
auto& server = net::get_local_messaging_service();
|
||||
|
||||
Reference in New Issue
Block a user