[vlc-commits] audioscrobbler: call recv() and document some existing bugs
Rémi Denis-Courmont
git at videolan.org
Sun May 10 21:05:40 CEST 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun May 10 19:58:18 2015 +0300| [c17d35d425bdc340bdd0440c42026da95e5aa2e4] | committer: Rémi Denis-Courmont
audioscrobbler: call recv() and document some existing bugs
With waitall set to false, net_Read() is identical to recv()
outside the input thread. This avoids allocating a bogus waitpipe.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c17d35d425bdc340bdd0440c42026da95e5aa2e4
---
modules/misc/audioscrobbler.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/modules/misc/audioscrobbler.c b/modules/misc/audioscrobbler.c
index 81e2a8b..187ebe0 100644
--- a/modules/misc/audioscrobbler.c
+++ b/modules/misc/audioscrobbler.c
@@ -38,6 +38,9 @@
#include <assert.h>
#include <time.h>
+#ifdef HAVE_POLL
+# include <poll.h>
+#endif
#define VLC_MODULE_LICENSE VLC_LICENSE_GPL_2_PLUS
#include <vlc_common.h>
@@ -829,8 +832,13 @@ static void *Run(void *data)
continue;
}
- i_net_ret = net_Read(p_intf, i_post_socket, NULL,
- p_buffer, sizeof(p_buffer) - 1, false);
+ /* FIXME: this might wait forever */
+ struct pollfd ufd = { .fd = i_post_socket, .events = POLLIN };
+ while( poll( &ufd, 1, -1 ) == -1 );
+
+ /* FIXME: With TCP, you should never assume that a single read will
+ * return the entire response... */
+ i_net_ret = recv(i_post_socket, p_buffer, sizeof(p_buffer) - 1, 0);
if (i_net_ret <= 0)
{
/* if we get no answer, something went wrong : try again */
More information about the vlc-commits
mailing list