Commits

Martin Gergov committed b55de93

Write is now like udp write(SOCK_DGRAM)

  • Participants
  • Parent commits cc3baa6

Comments (0)

Files changed (2)

File examples/newserver.py

         print self.counter
         if self.counter == 100:
             return
-        log.msg("received {0} from {1}".format(data, self.transport.getPeer()))
+        log.msg("received {0}:{1}".format(data, len(data)))
         self.transport.write(data, 10, False)
         self.counter += 1
 

File udt4twisted/udt.py

                                data, len(data), ttl, inorder)
         except udt.UDTException as ue:
             if ue[0] == EASYNCRCV:
-                return 0
+                return self.writeSomeData(data, ttl, inorder)
             elif ue[0] == ECONNLOST:
                 return main.CONNECTION_LOST
 
         if not self.connected or self._writeDisconnected:
             return
         if data:
-            self._tempDataBuffer.append(data)
-            self._tempDataLen += len(data)
-            self._ttl = ttl
-            self._inorder = inorder
-            self._maybePauseProducer()
+            # self._tempDataBuffer.append(data)
+            # self._tempDataLen += len(data)
+            # self._ttl = ttl
+            # self._inorder = inorder
+            # self._maybePauseProducer()
             self.startWriting()
+            l = self.writeSomeData(data, ttl, inorder)
+            if l == main.CONNECTION_LOST:
+                self.loseConnection()
+            
 
     def doWrite(self):
         """