mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 04:30:33 +00:00
Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next
This commit is contained in:
commit
dc374ed6ef
@ -103,14 +103,16 @@ void TcpCmdInterface::run_cmd_server(int tcp_port)
|
||||
|
||||
// Socket and acceptor
|
||||
boost::asio::io_service service;
|
||||
try
|
||||
{
|
||||
boost::asio::ip::tcp::acceptor acceptor(service, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port));
|
||||
|
||||
bool keep_running = true;
|
||||
while (keep_running)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::cout << "Telecommand TCP interface listening on port " << tcp_port << std::endl;
|
||||
|
||||
boost::asio::ip::tcp::socket socket(service);
|
||||
acceptor.accept(socket, not_throw);
|
||||
if (not_throw)
|
||||
@ -159,7 +161,7 @@ void TcpCmdInterface::run_cmd_server(int tcp_port)
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (error > 0); // && error != boost::asio::error::eof);
|
||||
while (!error); // && error != boost::asio::error::eof);
|
||||
|
||||
if (error == boost::asio::error::eof)
|
||||
{
|
||||
@ -173,12 +175,21 @@ void TcpCmdInterface::run_cmd_server(int tcp_port)
|
||||
// Close socket
|
||||
socket.close();
|
||||
}
|
||||
catch (const boost::exception &e)
|
||||
{
|
||||
std::cout << "Boost exception " << std::endl;
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
std::cout << "Exception " << ex.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const boost::exception &e)
|
||||
{
|
||||
std::cout << "TCP Command Interface exception: address already in use" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TcpCmdInterface::~TcpCmdInterface()
|
||||
|
@ -28,8 +28,8 @@
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef TCPCMDINTERFACE_H_
|
||||
#define TCPCMDINTERFACE_H_
|
||||
#ifndef GNSS_SDR_TCPCMDINTERFACE_H_
|
||||
#define GNSS_SDR_TCPCMDINTERFACE_H_
|
||||
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
@ -38,7 +38,7 @@
|
||||
#include <unordered_map>
|
||||
#include <algorithm>
|
||||
#include <boost/asio.hpp>
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
class TcpCmdInterface
|
||||
@ -61,4 +61,4 @@ private:
|
||||
void register_functions();
|
||||
};
|
||||
|
||||
#endif /* TCPCMDINTERFACE_H_ */
|
||||
#endif /* GNSS_SDR_TCPCMDINTERFACE_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user