libs/gst/net/gstnettimepacket.c: MSG_DONTWAIT is not defined on Cygwin, so work aroun...
authorTim-Philipp Müller <tim@centricular.net>
Tue, 11 Apr 2006 18:43:04 +0000 (18:43 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Tue, 11 Apr 2006 18:43:04 +0000 (18:43 +0000)
Original commit message from CVS:
* libs/gst/net/gstnettimepacket.c: (gst_net_time_packet_send):
MSG_DONTWAIT is not defined on Cygwin, so work
around that (fixes #317048).

ChangeLog
libs/gst/net/gstnettimepacket.c

index 607e815..6407d2f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-04-11  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * libs/gst/net/gstnettimepacket.c: (gst_net_time_packet_send):
+         MSG_DONTWAIT is not defined on Cygwin, so work
+         around that (fixes #317048).
+         
 2006-04-11  Wim Taymans  <wim@fluendo.com>
 
        * gst/gstelementfactory.c: (gst_element_register),
index 16c311a..6091c15 100644 (file)
 #include "config.h"
 #endif
 
+#ifdef __CYGWIN__
+# include <unistd.h>
+# include <fcntl.h>
+#endif
+
 #include "gstnettimepacket.h"
 
 
@@ -164,14 +169,29 @@ gint
 gst_net_time_packet_send (const GstNetTimePacket * packet, gint fd,
     struct sockaddr * addr, socklen_t len)
 {
+#ifdef __CYGWIN__
+  gint fdflags;
+#endif
   guint8 *buffer;
-  gint ret;
+  gint ret, send_flags;
 
   g_return_val_if_fail (packet != NULL, -EINVAL);
 
+#ifdef __CYGWIN__
+  send_flags = 0;
+  fdflags = fcntl (fd, F_GETFL);
+  fcntl (fd, F_SETFL, fdflags | O_NONBLOCK);
+#else
+  send_flags = MSG_DONTWAIT;
+#endif
+
   buffer = gst_net_time_packet_serialize (packet);
 
-  ret = sendto (fd, buffer, GST_NET_TIME_PACKET_SIZE, MSG_DONTWAIT, addr, len);
+  ret = sendto (fd, buffer, GST_NET_TIME_PACKET_SIZE, send_flags, addr, len);
+
+#ifdef __CYGWIN__
+  fcntl (fd, F_SETFL, fdflags);
+#endif
 
   g_free (buffer);