Martin Gergov avatar Martin Gergov committed 134429c

Cleaning of udt sockets fixed..

Comments (0)

Files changed (4)

-Summary
-=======
+=========
+ Summary
+=========
+
 
 Integration of udt as a transport protocol in twisted.
 
 
-Prerequisites
-=============
+===============
+ Prerequisites
+===============
+
+
 
 #) PyUDT
 #) twisted
+#) foolscap(for logging)

tests/test_udt_reactor.py

+import socket as s
+from twisted.trial import unittest
+from twisted.internet.protocol import DatagramProtocol
+from twisted.internet import reactor
+from twisted.internet import udp
+import udt4
+from udt4twisted import udt
+
+class Echo(DatagramProtocol):
+
+    def datagramReceived(self, data, (host, port)):
+        log.msg("received %r from %s:%d" % (data, host, port))
+        self.transport.write(data, (host, port))
+
+class TestUDTReactor(unittest.TestCase):
+
+    def test_system_sockets_init(self):
+        pass
+

udt4twisted/udt.py

 
     def doConnect(self, fd=None):
         if not fd:
-            # self.doWrite = self.doConnect
             self.doRead = self.doConnect
             self.socket = self.createInternetSocket()
             self.fileno = self.socket.fileno
             self.socket.connect_ex(self._connectedAddr)
             self._connectDone()
             return
-        
         try:
-            print "recv from:", fd, " size:", udt.UDT_RCVDATE
-            #FIXME
             data = udt.recvmsg(fd, self.maxPacketSize)
             addr = self._connectedAddr
         except udt.UDTException as ue:

udt4twisted/udtepollreactor.py

         has gone away.
         """
         if isinstance(xer, udt.Port):
-            fd = xer.socket.UDTSOCKET
+            fd = xer.socket.UDTSOCKET.UDTSOCKET
         else:
             fd = xer.fileno()
-            
+         
         if fd == -1:
             for fd, fdes in selectables.items():
                 if xer is fdes:
             else:
                 flags = event
                 if isinstance(xer, udt.Port):
-                    del selectables[fd.UDTSOCKET]
+                    
+                    del selectables[fd]
                 else:
                     del selectables[fd]
                 # See comment above _control call in _add.
                     except TypeError:
                         pass
             del primary[fd]
+        
 
     def _handleSystemSocketSet(self, set, event):
         _drdw = self._doReadOrWrite
 
         #handle UDT sockets
         uread, uwrite = l[:2]
-        print uread, uwrite, timeout
+        #print uread, uwrite, timeout
         self._handleUDTReadSocketSet(uread, self._POLL_IN)
         self._handleUDTWriteSocketSet(uwrite, self._POLL_OUT)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.