瀏覽代碼

reliable packet throttle tweak

eihrul 14 年之前
父節點
當前提交
1e18fd6001
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      protocol.c

+ 3 - 1
protocol.c

@@ -1291,7 +1291,9 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
 
        if (outgoingCommand -> packet != NULL)
        {
-          if (peer -> reliableDataInTransit + outgoingCommand -> fragmentLength > peer -> windowSize)
+          enet_uint32 windowSize = (peer -> packetThrottle * peer -> windowSize) / ENET_PEER_PACKET_THROTTLE_SCALE;
+
+          if (peer -> reliableDataInTransit + outgoingCommand -> fragmentLength > ENET_MAX (windowSize, peer -> mtu))
             break;
 
           if ((enet_uint16) (peer -> mtu - host -> packetSize) < (enet_uint16) (commandSize + outgoingCommand -> fragmentLength))