Project "Tuxbox-GIT: apps":

The branch, master has been updated
       via  d28c0857af1346b73564b00091069453db874ace (commit)
      from  9f02607d0beb28e38ab4609f7bdfadad70eeb016 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit d28c0857af1346b73564b00091069453db874ace
Author: [CST] Focus <focus....@gmail.com>
Date:   Thu May 28 16:07:00 2015 +0200

    UPNPDevice.cpp: change to non-blocking recv
    
    Signed-off-by: GetAway <get-a...@t-online.de>

diff --git a/misc/libs/libupnpclient/UPNPDevice.cpp 
b/misc/libs/libupnpclient/UPNPDevice.cpp
index 90a85e7..00a768f 100644
--- a/misc/libs/libupnpclient/UPNPDevice.cpp
+++ b/misc/libs/libupnpclient/UPNPDevice.cpp
@@ -34,6 +34,8 @@
 #include <poll.h>
 #include "upnpclient.h"
 #include <unistd.h>
+#include <errno.h>
+#include <stdio.h>
 
 struct ToLower
 {
@@ -433,11 +435,32 @@ std::string CUPnPDevice::HTTP(std::string url, 
std::string post, std::string act
 
        commandstr = command.str();
        result = send(t_socket, commandstr.c_str(), commandstr.size(), 0);
+#if 0
        while ((received = recv(t_socket, buf, sizeof(buf)-1, 0)) > 0)
        {
                buf[received] = 0;
                reply << buf;
        }
+#endif
+       struct pollfd fds[1];
+       fds[0].fd = t_socket;
+       fds[0].events = POLLIN;
+       while (true) {
+               int result = poll(fds, 1, 4000);
+               if (result < 0) {
+                       printf("CUPnPDevice::HTTP: poll error %s\n", 
strerror(errno));
+                       break;
+               }
+               if (result == 0) {
+                       printf("CUPnPDevice::HTTP: poll timeout\n");
+                       break;
+               }
+               received = recv(t_socket, buf, sizeof(buf)-1, 0);
+               if (received <= 0)
+                       break;
+               buf[received] = 0;
+               reply << buf;
+       }
        close(t_socket);
        return reply.str();
 }

-----------------------------------------------------------------------

Summary of changes:
 misc/libs/libupnpclient/UPNPDevice.cpp |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)


-- 
Tuxbox-GIT: apps

------------------------------------------------------------------------------
_______________________________________________
Tuxbox-cvs-commits mailing list
Tuxbox-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tuxbox-cvs-commits

Reply via email to