[pypy-svn] r72896 - pypy/trunk/pypy/rlib

arigo at codespeak.net arigo at codespeak.net
Fri Mar 26 14:54:15 CET 2010


Author: arigo
Date: Fri Mar 26 14:54:14 2010
New Revision: 72896

Modified:
   pypy/trunk/pypy/rlib/rsocket.py
Log:
Initialize the family to the correct value.  Avoids surprizes on
Windows when calling a function that unexpectedly does not set
the output address (e.g. recvfrom() on a connected IPv4 socket).


Modified: pypy/trunk/pypy/rlib/rsocket.py
==============================================================================
--- pypy/trunk/pypy/rlib/rsocket.py	(original)
+++ pypy/trunk/pypy/rlib/rsocket.py	Fri Mar 26 14:54:14 2010
@@ -506,6 +506,10 @@
     klass = familyclass(family)
     result = instantiate(klass)
     buf = lltype.malloc(rffi.CCHARP.TO, klass.maxlen, flavor='raw', zero=True)
+    # Initialize the family to the correct value.  Avoids surprizes on
+    # Windows when calling a function that unexpectedly does not set
+    # the output address (e.g. recvfrom() on a connected IPv4 socket).
+    rffi.setintfield(rffi.cast(_c.sockaddr_ptr, buf), 'c_sa_family', family)
     result.setdata(buf, 0)
     return result, klass.maxlen
 



More information about the Pypy-commit mailing list