[pypy-svn] r46768 - in pypy/dist/pypy/rlib: . test

arigo at codespeak.net arigo at codespeak.net
Thu Sep 20 16:03:56 CEST 2007


Author: arigo
Date: Thu Sep 20 16:03:56 2007
New Revision: 46768

Modified:
   pypy/dist/pypy/rlib/rsocket_rffi.py
   pypy/dist/pypy/rlib/test/test_rsocket_rffi.py
Log:
All tests pass on Linux.  Still many XXXs left on Windows.


Modified: pypy/dist/pypy/rlib/rsocket_rffi.py
==============================================================================
--- pypy/dist/pypy/rlib/rsocket_rffi.py	(original)
+++ pypy/dist/pypy/rlib/rsocket_rffi.py	Thu Sep 20 16:03:56 2007
@@ -509,14 +509,17 @@
             if self.timeout <= 0.0 or self.fd < 0:
                 # blocking I/O or no socket.
                 return 0
-            pollfd = _c.pollfd()
-            pollfd.fd = self.fd
-            if for_writing:
-                pollfd.events = _c.POLLOUT
-            else:
-                pollfd.events = _c.POLLIN
-            timeout = int(self.timeout * 1000.0 + 0.5)
-            n = _c.poll(byref(pollfd), 1, timeout)
+            pollfd = rffi.make(_c.pollfd)
+            try:
+                rffi.setintfield(pollfd, 'c_fd', self.fd)
+                if for_writing:
+                    rffi.setintfield(pollfd, 'c_events', _c.POLLOUT)
+                else:
+                    rffi.setintfield(pollfd, 'c_events', _c.POLLIN)
+                timeout = int(self.timeout * 1000.0 + 0.5)
+                n = _c.poll(pollfd, 1, timeout)
+            finally:
+                lltype.free(pollfd, flavor='raw')
             if n < 0:
                 return -1
             if n == 0:
@@ -527,6 +530,7 @@
         def _select(self, for_writing):
             """Returns 0 when reading/writing is possible,
             1 when timing out and -1 on error."""
+            XXX
             if self.timeout <= 0.0 or self.fd < 0:
                 # blocking I/O or no socket.
                 return 0

Modified: pypy/dist/pypy/rlib/test/test_rsocket_rffi.py
==============================================================================
--- pypy/dist/pypy/rlib/test/test_rsocket_rffi.py	(original)
+++ pypy/dist/pypy/rlib/test/test_rsocket_rffi.py	Thu Sep 20 16:03:56 2007
@@ -288,7 +288,6 @@
     HOST = 'localhost'
 
     def setup_method(self, method):
-        py.test.skip("in-progress")
         self.serv = RSocket(AF_INET, SOCK_STREAM)
         self.serv.setsockopt_int(SOL_SOCKET, SO_REUSEADDR, 1)
         self.serv.bind(INETAddress(self.HOST, self.PORT))



More information about the Pypy-commit mailing list