Socket: fixed bug in readfrom where socklen was not set
tho [Mon, 15 Jun 2009 14:55:47 +0000 (14:55 +0000)]
git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1232 270642c3-0616-0410-b53a-bc976706d245

Socket/ReadWritePolicy.cc
Socket/ReadWritePolicy.cti
Socket/ReadWritePolicy.hh

index c842604..9ca08ad 100644 (file)
@@ -61,11 +61,11 @@ prefix_ unsigned senf::ReadablePolicy::read(FileHandle handle, char * buffer,
 
 prefix_ unsigned senf::ReadablePolicy::do_readfrom(FileHandle handle, char * buffer,
                                                           unsigned size,
-                                                          struct ::sockaddr * addr, socklen_t len)
+                                                          struct ::sockaddr * addr, socklen_t * len)
 {
     int rv = -1;
     do {
-        rv = ::recvfrom(handle.fd(),buffer, size, 0, addr, &len);
+        rv = ::recvfrom(handle.fd(),buffer, size, 0, addr, len);
         if (rv < 0)
             switch (errno) {
             case EINTR:
index 618c2d3..edb7915 100644 (file)
@@ -38,7 +38,7 @@ readfrom(ClientSocketHandle<SPolicy> handle, char * buffer, unsigned size,
          typename SPolicy::AddressingPolicy::Address & address,
          typename IfCommunicationPolicyIs<SPolicy,UnconnectedCommunicationPolicy>::type *)
 {
-    return do_readfrom(handle, buffer, size, address.sockaddr_p(), address.socklen());
+    return do_readfrom(handle, buffer, size, address.sockaddr_p(), address.socklen_p());
 }
 #else
 template <class SPolicy>
index 023b3f6..24d5cea 100644 (file)
@@ -78,7 +78,7 @@ namespace senf {
 
     private:
         static unsigned do_readfrom(FileHandle handle, char * buffer, unsigned size,
-                                    struct ::sockaddr * addr, socklen_t len);
+                                    struct ::sockaddr * addr, socklen_t * len);
     };
 
     /** \brief ReadPolicy for unreadable sockets