Skip to content

Commit

Permalink
fix Mobsya#811 by calling only once update_discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Bonani committed Oct 13, 2020
1 parent 43189ea commit e0de657
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions aseba/thymio-device-manager/aseba_node_registery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ aseba_node_registery::node_map aseba_node_registery::nodes() const {

void aseba_node_registery::set_tcp_endpoint(const boost::asio::ip::tcp::endpoint& endpoint) {
m_nodes_service_desc.endpoint(endpoint);
update_discovery();
//update_discovery(); //make in only once after ws_endpoint
}

void aseba_node_registery::set_ws_endpoint(const boost::asio::ip::tcp::endpoint& endpoint) {
Expand Down Expand Up @@ -136,8 +136,9 @@ void aseba_node_registery::on_update_discovery_complete(const boost::system::err
mLogError("Discovery : {}", ec.message());
} else {
mLogTrace("Discovery : update complete");
m_updating_discovery = false;
}
m_updating_discovery = false;
if(m_discovery_needs_update) {
boost::asio::post(boost::asio::get_associated_executor(this),
boost::bind(&aseba_node_registery::update_discovery, this));
Expand Down
3 changes: 2 additions & 1 deletion aseba/thymio-device-manager/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ void run_service(boost::asio::io_context& ctx) {

// Create a server for websocket
mobsya::application_server<mobsya::websocket_t> websocket_server(ctx, 8597);
node_registery.set_ws_endpoint(websocket_server.endpoint());
websocket_server.accept();
node_registery.set_ws_endpoint(websocket_server.endpoint());


#ifdef MOBSYA_TDM_ENABLE_USB
mobsya::usb_server usb_server(ctx, {mobsya::THYMIO2_DEVICE_ID, mobsya::THYMIO_WIRELESS_DEVICE_ID});
Expand Down

0 comments on commit e0de657

Please sign in to comment.