Author: andrewjlawrence
Branch: winoverlapped
Changeset: r95912:eb3c85f76e9d
Date: 2019-02-08 21:43 +0000
http://bitbucket.org/pypy/pypy/changeset/eb3c85f76e9d/

Log:    Started implementing WSARecv

diff --git a/lib_pypy/_overlapped.py b/lib_pypy/_overlapped.py
--- a/lib_pypy/_overlapped.py
+++ b/lib_pypy/_overlapped.py
@@ -39,10 +39,15 @@
     def __init__(self, handle):
         self.overlapped = _ffi.new('OVERLAPPED[1]')
         self.handle = handle
+        ### I can't see these buffers being used.
+        ### it is possible that we could delete them.
         self.readbuffer = None
+        self.writebuffer = None
+
+        self.allocated_buffer = None
+        self.user_buffer = None
         self.pending = 0
         self.completed = 0
-        self.writebuffer = None
         self.type = OverlappedType.TYPE_NONE
         self.overlapped[0].hEvent = \
                 _kernel32.CreateEventW(NULL, True, False, NULL)
@@ -98,6 +103,15 @@
             ### If we are to support xp we will need to dynamically load the 
below method
             _kernel32.CancelIoEx(self.handle, self.overlapped)        
         return result
+     
+    def WSARecv(self ,handle, size, flags):
+        if self.type != OverlappedType.TYPE_NONE:
+            raise _winapi._WinError()
+        
+        self.type = OverlappedType.TYPE_READ
+        self.handle = handle
+        self.allocated_buffer = _ffi.buffer(max(1, size))
+        return do_WSARecv(self, handle, self.allocated_buffer[:], size, flags)
 
 
 def _int2intptr(int2cast):
@@ -188,3 +202,6 @@
                                                     
_kernel32.WT_EXECUTEINWAITTHREAD | _kernel32.WT_EXECUTEONLYONCE)
     
     return newwaitobject
+
+    
+    
\ No newline at end of file
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to