forked from Archive/PX4-Autopilot
make socket non-blocking, moved socket includes to header file to avoid forward declarations
This commit is contained in:
parent
39711ca908
commit
9119687177
|
@ -45,10 +45,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <drivers/drv_led.h>
|
#include <drivers/drv_led.h>
|
||||||
#ifndef __PX4_QURT
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#endif
|
|
||||||
#include "simulator.h"
|
#include "simulator.h"
|
||||||
|
|
||||||
using namespace simulator;
|
using namespace simulator;
|
||||||
|
@ -378,6 +375,11 @@ void Simulator::updateSamples()
|
||||||
// this is used to time message sending
|
// this is used to time message sending
|
||||||
_time_last = hrt_absolute_time();
|
_time_last = hrt_absolute_time();
|
||||||
|
|
||||||
|
// make socket non-blocking
|
||||||
|
int flags = fcntl(_fd,F_GETFL);
|
||||||
|
flags |= O_NONBLOCK;
|
||||||
|
fcntl(_fd, F_SETFL, flags);
|
||||||
|
|
||||||
int len = 0;
|
int len = 0;
|
||||||
// wait for new mavlink messages to arrive
|
// wait for new mavlink messages to arrive
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
|
@ -51,6 +51,10 @@
|
||||||
#include <uORB/uORB.h>
|
#include <uORB/uORB.h>
|
||||||
#include <v1.0/mavlink_types.h>
|
#include <v1.0/mavlink_types.h>
|
||||||
#include <v1.0/common/mavlink.h>
|
#include <v1.0/common/mavlink.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#ifndef __PX4_QURT
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace simulator {
|
namespace simulator {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue