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 <sys/types.h>
|
||||
#include <drivers/drv_led.h>
|
||||
#ifndef __PX4_QURT
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include "simulator.h"
|
||||
|
||||
using namespace simulator;
|
||||
|
@ -378,6 +375,11 @@ void Simulator::updateSamples()
|
|||
// this is used to time message sending
|
||||
_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;
|
||||
// wait for new mavlink messages to arrive
|
||||
for (;;) {
|
||||
|
|
|
@ -51,6 +51,10 @@
|
|||
#include <uORB/uORB.h>
|
||||
#include <v1.0/mavlink_types.h>
|
||||
#include <v1.0/common/mavlink.h>
|
||||
#include <sys/socket.h>
|
||||
#ifndef __PX4_QURT
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
namespace simulator {
|
||||
|
||||
|
|
Loading…
Reference in New Issue