Socket: Fix extra available() call in readfrom()
g0dil [Tue, 4 May 2010 22:12:35 +0000 (22:12 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1618 270642c3-0616-0410-b53a-bc976706d245

senf/Socket/ClientSocketHandle.ct

index 4a22c91..8bcde15 100644 (file)
@@ -130,10 +130,9 @@ template <class Sequence>
 prefix_ void senf::ClientSocketHandle<SPolicy>::readfrom(Sequence & container, Address & from,
                                                         unsigned limit)
 {
-    unsigned nread (available());
-    if (limit>0 && nread>limit)
-        nread = limit;
-    container.resize(nread);
+    if (limit == 0)
+        limit = available();
+    container.resize(limit);
     container.erase(readfrom( std::make_pair(container.begin(), container.end()), from ),
                     container.end());
 }