瀏覽代碼

don't send zero-length datagrams

David Rose 20 年之前
父節點
當前提交
0e136bdf9a
共有 1 個文件被更改,包括 8 次插入7 次删除
  1. 8 7
      direct/src/distributed/ConnectionRepository.py

+ 8 - 7
direct/src/distributed/ConnectionRepository.py

@@ -504,13 +504,14 @@ class ConnectionRepository(
         pass
 
     def send(self, datagram):
-        if ConnectionRepository.notify.getDebug():
-            print "ConnectionRepository sending datagram:"
-            datagram.dumpHex(ostream)
-
-        self.sendDatagram(datagram)
-
-
+        # Zero-length datagrams might freak out the server.  No point
+        # in sending them, anyway.
+        if datagram.getLength() > 0:
+            if ConnectionRepository.notify.getDebug():
+                print "ConnectionRepository sending datagram:"
+                datagram.dumpHex(ostream)
+
+            self.sendDatagram(datagram)
 
     # debugging funcs for simulating a network-plug-pull
     def pullNetworkPlug(self):