mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-10-17 07:03:02 -04:00
this is a more "clean" conversion to 64 bit than the type-fixups branch, which does borrow some elements from it but has far less find and replace...it is about 98-99% done, notes to follow later
This commit is contained in:
+7
-7
@@ -250,7 +250,7 @@ void UdpConnection::SendTerminatePacket(int connectCode, DisconnectReason reason
|
||||
buf[0] = 0;
|
||||
buf[1] = cUdpPacketTerminate;
|
||||
UdpMisc::PutValue32(buf + 2, connectCode);
|
||||
UdpMisc::PutValue16(buf + 6, (udp_ushort)reason);
|
||||
UdpMisc::PutValue16(buf + 6, (uint16_t)reason);
|
||||
PhysicalSend(buf, 8, true);
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int
|
||||
udp_uchar *bufPtr = tempBuffer;
|
||||
bufPtr[0] = 0;
|
||||
bufPtr[1] = cUdpPacketOrdered;
|
||||
UdpMisc::PutValue16(bufPtr + 2, (udp_ushort)(++mOrderedCountOutgoing & 0xffff));
|
||||
UdpMisc::PutValue16(bufPtr + 2, (uint16_t)(++mOrderedCountOutgoing & 0xffff));
|
||||
memcpy(bufPtr + 4, data, dataLen);
|
||||
if (data2 != nullptr)
|
||||
memcpy(bufPtr + 4 + dataLen, data2, dataLen2);
|
||||
@@ -361,7 +361,7 @@ bool UdpConnection::InternalSend(UdpChannel channel, const udp_uchar *data, int
|
||||
udp_uchar *bufPtr = tempBuffer;
|
||||
bufPtr[0] = 0;
|
||||
bufPtr[1] = cUdpPacketOrdered2;
|
||||
UdpMisc::PutValue16(bufPtr + 2, (udp_ushort)(++mOrderedCountOutgoing2 & 0xffff));
|
||||
UdpMisc::PutValue16(bufPtr + 2, (uint16_t)(++mOrderedCountOutgoing2 & 0xffff));
|
||||
memcpy(bufPtr + 4, data, dataLen);
|
||||
if (data2 != nullptr)
|
||||
memcpy(bufPtr + 4 + dataLen, data2, dataLen2);
|
||||
@@ -731,7 +731,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen)
|
||||
}
|
||||
case cUdpPacketOrdered:
|
||||
{
|
||||
udp_ushort orderedStamp = UdpMisc::GetValue16(data + 2);
|
||||
uint16_t orderedStamp = UdpMisc::GetValue16(data + 2);
|
||||
int diff = (int)orderedStamp - (int)mOrderedStampLast;
|
||||
if (diff <= 0) // equal here makes it strip dupes too
|
||||
diff += 0x10000;
|
||||
@@ -749,7 +749,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen)
|
||||
}
|
||||
case cUdpPacketOrdered2:
|
||||
{
|
||||
udp_ushort orderedStamp = UdpMisc::GetValue16(data + 2);
|
||||
uint16_t orderedStamp = UdpMisc::GetValue16(data + 2);
|
||||
int diff = (int)orderedStamp - (int)mOrderedStampLast2;
|
||||
if (diff <= 0) // equal here makes it strip dupes too
|
||||
diff += 0x10000;
|
||||
@@ -898,7 +898,7 @@ void UdpConnection::ProcessCookedPacket(const udp_uchar *data, int dataLen)
|
||||
if (mUdpManager->mProcessingInducedLag > 1000) // if it has been over a second since our manager got processing time, then we should ignore the timing aspects of the clock-sync packets as we will have introduced too much lag ourselves.
|
||||
break;
|
||||
|
||||
udp_ushort curStamp = mUdpManager->LocalSyncStampShort();
|
||||
uint16_t curStamp = mUdpManager->LocalSyncStampShort();
|
||||
int roundTime = UdpMisc::SyncStampShortDeltaTime(pp.timeStamp, curStamp);
|
||||
|
||||
mSyncStatCount++;
|
||||
@@ -1374,7 +1374,7 @@ void UdpConnection::PhysicalSend(const udp_uchar *data, int dataLen, bool append
|
||||
*crcPtr = (udp_uchar)(crc & 0xff);
|
||||
break;
|
||||
case 2:
|
||||
UdpMisc::PutValue16(crcPtr, (udp_ushort)(crc & 0xffff));
|
||||
UdpMisc::PutValue16(crcPtr, (uint16_t)(crc & 0xffff));
|
||||
break;
|
||||
case 3:
|
||||
UdpMisc::PutValue24(crcPtr, crc & 0xffffff);
|
||||
|
||||
+15
-13
@@ -4,6 +4,8 @@
|
||||
// Copyright 2004 Sony Online Entertainment, all rights reserved.
|
||||
// Author: Jeff Petersen
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace UdpLibrary
|
||||
{
|
||||
|
||||
@@ -177,9 +179,9 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub
|
||||
// packet travel times under 32 seconds, would should be completely safe. You must use the
|
||||
// UdpManager::SyncStampDeltaTime function in order to calculate the elapsed time between
|
||||
// the two stamps.
|
||||
udp_ushort ServerSyncStampShort() const;
|
||||
uint16_t ServerSyncStampShort() const;
|
||||
udp_uint ServerSyncStampLong() const;
|
||||
int ServerSyncStampShortElapsed(udp_ushort syncStamp) const;
|
||||
int ServerSyncStampShortElapsed(uint16_t syncStamp) const;
|
||||
int ServerSyncStampLongElapsed(udp_uint syncStamp) const;
|
||||
|
||||
// returns the IP address/port this connection is linked to
|
||||
@@ -355,8 +357,8 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub
|
||||
|
||||
int mOrderedCountOutgoing;
|
||||
int mOrderedCountOutgoing2;
|
||||
udp_ushort mOrderedStampLast;
|
||||
udp_ushort mOrderedStampLast2;
|
||||
uint16_t mOrderedStampLast;
|
||||
uint16_t mOrderedStampLast2;
|
||||
|
||||
udp_uchar *mEncryptXorBuffer;
|
||||
int mEncryptExpansionBytes;
|
||||
@@ -443,7 +445,7 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub
|
||||
{
|
||||
udp_uchar zeroByte;
|
||||
udp_uchar packetType;
|
||||
udp_ushort timeStamp;
|
||||
uint16_t timeStamp;
|
||||
int masterPingTime;
|
||||
int averagePingTime;
|
||||
int lowPingTime;
|
||||
@@ -457,7 +459,7 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub
|
||||
{
|
||||
udp_uchar zeroByte;
|
||||
udp_uchar packetType;
|
||||
udp_ushort timeStamp;
|
||||
uint16_t timeStamp;
|
||||
udp_uint serverSyncStampLong;
|
||||
udp_int64 yourSent;
|
||||
udp_int64 yourReceived;
|
||||
@@ -469,7 +471,7 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub
|
||||
{
|
||||
udp_uchar zeroByte;
|
||||
udp_uchar packetType;
|
||||
udp_ushort reliableStamp;
|
||||
uint16_t reliableStamp;
|
||||
};
|
||||
|
||||
struct UdpPacketReliableFragmentStart
|
||||
@@ -482,14 +484,14 @@ class UdpConnection : public UdpGuardedRefCount, public PriorityQueueMember, pub
|
||||
{
|
||||
udp_uchar zeroByte;
|
||||
udp_uchar packetType;
|
||||
udp_ushort reliableStamp;
|
||||
uint16_t reliableStamp;
|
||||
};
|
||||
|
||||
struct UdpPacketOrdered
|
||||
{
|
||||
udp_uchar zeroByte;
|
||||
udp_uchar packetType;
|
||||
udp_ushort orderStamp;
|
||||
uint16_t orderStamp;
|
||||
};
|
||||
|
||||
|
||||
@@ -524,7 +526,7 @@ inline void UdpConnection::ScheduleTimeNow()
|
||||
{
|
||||
// if we are current in our GiveTime function getting time, then there is no need to reprioritize to 0 when we send a raw packet, since
|
||||
// the last thing we do in out GiveTime is do a scheduling calculation based on the last time a packet was sent. This little check
|
||||
// prevents us from reprioritizing to 0, only to shortly thereafter be reprioritized to where we actually belong.
|
||||
// prevents us from reprioritizing to 0, only to int16_tly thereafter be reprioritized to where we actually belong.
|
||||
if (!mGettingTime)
|
||||
{
|
||||
if (mUdpManager != nullptr)
|
||||
@@ -596,12 +598,12 @@ inline int UdpConnection::LastSend() const
|
||||
return(mUdpManager->CachedClockElapsed(mLastSendTime));
|
||||
}
|
||||
|
||||
inline udp_ushort UdpConnection::ServerSyncStampShort() const
|
||||
inline uint16_t UdpConnection::ServerSyncStampShort() const
|
||||
{
|
||||
UdpGuard guard(&mGuard);
|
||||
if (mUdpManager == nullptr)
|
||||
return(0);
|
||||
return((udp_ushort)(mUdpManager->LocalSyncStampShort() + (mSyncTimeDelta & 0xffff)));
|
||||
return((uint16_t)(mUdpManager->LocalSyncStampShort() + (mSyncTimeDelta & 0xffff)));
|
||||
}
|
||||
|
||||
inline udp_uint UdpConnection::ServerSyncStampLong() const
|
||||
@@ -612,7 +614,7 @@ inline udp_uint UdpConnection::ServerSyncStampLong() const
|
||||
return(mUdpManager->LocalSyncStampLong() + mSyncTimeDelta);
|
||||
}
|
||||
|
||||
inline int UdpConnection::ServerSyncStampShortElapsed(udp_ushort syncStamp) const
|
||||
inline int UdpConnection::ServerSyncStampShortElapsed(uint16_t syncStamp) const
|
||||
{
|
||||
return(UdpMisc::SyncStampShortDeltaTime(syncStamp, ServerSyncStampShort()));
|
||||
}
|
||||
|
||||
+2
-2
@@ -99,7 +99,7 @@ bool UdpPlatformDriver::SocketOpen(int port, int incomingBufferSize, int outgoin
|
||||
// bind it to any address
|
||||
struct sockaddr_in addr_loc;
|
||||
addr_loc.sin_family = PF_INET;
|
||||
addr_loc.sin_port = htons((unsigned short)port);
|
||||
addr_loc.sin_port = htons((uint16_t)port);
|
||||
addr_loc.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
if (bindIpAddress != nullptr && bindIpAddress[0] != 0)
|
||||
{
|
||||
@@ -157,7 +157,7 @@ bool UdpPlatformDriver::SocketSend(const char *data, int dataLen, const UdpPlatf
|
||||
struct sockaddr_in addr_dest;
|
||||
addr_dest.sin_family = PF_INET;
|
||||
memcpy(&addr_dest.sin_addr.s_addr, ipAddress->mData, 4);
|
||||
addr_dest.sin_port = htons((unsigned short)port);
|
||||
addr_dest.sin_port = htons((uint16_t)port);
|
||||
if (SOCKET_ERROR == sendto(mData->socket, data, dataLen, 0, (struct sockaddr *)&addr_dest, sizeof(addr_dest)))
|
||||
{
|
||||
return(false);
|
||||
|
||||
+2
-2
@@ -100,7 +100,7 @@ bool UdpPlatformDriver::SocketOpen(int port, int incomingBufferSize, int outgoin
|
||||
// bind it to any address
|
||||
struct sockaddr_in addr_loc;
|
||||
addr_loc.sin_family = PF_INET;
|
||||
addr_loc.sin_port = htons((unsigned short)port);
|
||||
addr_loc.sin_port = htons((uint16_t)port);
|
||||
addr_loc.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
if (bindIpAddress != nullptr && bindIpAddress[0] != 0)
|
||||
{
|
||||
@@ -163,7 +163,7 @@ bool UdpPlatformDriver::SocketSend(const char *data, int dataLen, const UdpPlatf
|
||||
struct sockaddr_in addr_dest;
|
||||
addr_dest.sin_family = PF_INET;
|
||||
memcpy(&addr_dest.sin_addr.s_addr, ipAddress->mData, 4);
|
||||
addr_dest.sin_port = htons((unsigned short)port);
|
||||
addr_dest.sin_port = htons((uint16_t)port);
|
||||
if (SOCKET_ERROR == sendto(mData->socket, data, dataLen, 0, (struct sockaddr *)&addr_dest, sizeof(addr_dest)))
|
||||
{
|
||||
return(false);
|
||||
|
||||
@@ -237,7 +237,7 @@ struct UdpParams
|
||||
// to be kept alive, or at least kept alive very often (like for a chat server perhaps where nobody is talking much).
|
||||
// For some people, it may be necessary to send data more frequently in order to keep their NAT mapping fresh, or their
|
||||
// firewall software happy. However, we don't want to be in a situation where our server is receiving a lot more data
|
||||
// than it needs to just so these people can keep their port open. I have seen NAT's that lose mappings in as short
|
||||
// than it needs to just so these people can keep their port open. I have seen NAT's that lose mappings in as int16_t
|
||||
// as 20 seconds. What this feature does is a bit tricky. It changes the time-to-live (TTL) for a special keep-alive
|
||||
// packet to some small value (4) which is enough for the packet to get past firewalls and NAT's, but not make it all
|
||||
// the way to our server. In this manner, the port gets kept alive, but we don't waste bandwidth with these packets.
|
||||
@@ -285,7 +285,7 @@ struct UdpParams
|
||||
// them and terminate the connection. When a packet is successfully received into the connection in question, the
|
||||
// retry period is reset, such that the next time an ICMP error comes in, it has another period of time for it
|
||||
// to resolve the issue. This servers a couple purpose, 1) it can allow for momentary outages that can be recovered
|
||||
// from in short order, and 2) it is necessary for the port-remapping feature to work properly in situations where
|
||||
// from in int16_t order, and 2) it is necessary for the port-remapping feature to work properly in situations where
|
||||
// the server may send data to the old-port before the remapping negotiations are completed. In order for the
|
||||
// remapping feature to work properly, this value should be set to larger than the longest time a connection typically
|
||||
// goes without receiving data from the other side. (0=no grace period)
|
||||
@@ -574,7 +574,7 @@ class UdpManager : public UdpGuardedRefCount
|
||||
ErrorCondition GetErrorCondition() const;
|
||||
|
||||
// previous UdpMisc stuff that now needs driver
|
||||
udp_ushort LocalSyncStampShort(); // gets a local-clock based sync-stamp. (only good for timings up to 32 seconds)
|
||||
uint16_t LocalSyncStampShort(); // gets a local-clock based sync-stamp. (only good for timings up to 32 seconds)
|
||||
udp_uint LocalSyncStampLong(); // gets a local-clock based sync-stamp. (good for timings up to 23 days)
|
||||
int ClockElapsed(UdpClockStamp stamp); // returns a elapsed time since stamp in milliseconds (if elapsed is over 23 days, it returns 23 days)
|
||||
UdpClockStamp Clock();
|
||||
@@ -991,9 +991,9 @@ inline int UdpManager::ClockElapsed(UdpClockStamp stamp)
|
||||
return(UdpMisc::ClockDiff(stamp, Clock()));
|
||||
}
|
||||
|
||||
inline udp_ushort UdpManager::LocalSyncStampShort()
|
||||
inline uint16_t UdpManager::LocalSyncStampShort()
|
||||
{
|
||||
return((udp_ushort)(Clock() & 0xffff));
|
||||
return((uint16_t)(Clock() & 0xffff));
|
||||
}
|
||||
|
||||
inline udp_uint UdpManager::LocalSyncStampLong()
|
||||
|
||||
@@ -14,9 +14,9 @@ namespace UdpLibrary
|
||||
// UdpMisc functions
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int UdpMisc::SyncStampShortDeltaTime(udp_ushort stamp1, udp_ushort stamp2)
|
||||
int UdpMisc::SyncStampShortDeltaTime(uint16_t stamp1, uint16_t stamp2)
|
||||
{
|
||||
udp_ushort delta = (udp_ushort)(stamp1 - stamp2);
|
||||
uint16_t delta = (uint16_t)(stamp1 - stamp2);
|
||||
if (delta > 0x7fff)
|
||||
return((int)(0xffff - delta));
|
||||
return((int)delta);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// Copyright 2004 Sony Online Entertainment, all rights reserved.
|
||||
// Author: Jeff Petersen
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "UdpDriver.h"
|
||||
@@ -32,7 +33,7 @@ class UdpMisc
|
||||
// you a sync-stamp that you can compare with ServerSyncStampShort values generated on other
|
||||
// machines that are synchronized against the same server. This ServerSyncStampShort function and
|
||||
// this delta time function serve as the basis for calculating one-way travel times for packets.
|
||||
static int SyncStampShortDeltaTime(udp_ushort stamp1, udp_ushort stamp2);
|
||||
static int SyncStampShortDeltaTime(uint16_t stamp1, uint16_t stamp2);
|
||||
static int SyncStampLongDeltaTime(udp_uint stamp1, udp_uint stamp2); // same as Short version only no limit
|
||||
|
||||
// used to alloc/resize/free an allocation previously created with this function
|
||||
@@ -56,13 +57,13 @@ class UdpMisc
|
||||
static int PutValue64(void *buffer, udp_int64 value); // puts a 64-bit value into the buffer in big-endian format, returns number of bytes used(8)
|
||||
static int PutValue32(void *buffer, udp_uint value); // puts a 32-bit value into the buffer in big-endian format, returns number of bytes used(4)
|
||||
static int PutValue24(void *buffer, udp_uint value); // puts a 24-bit value into the buffer in big-endian format, returns number of bytes used(4)
|
||||
static int PutValue16(void *buffer, udp_ushort value); // puts a 16-bit value into the buffer in big-endian format, returns number of bytes used(2)
|
||||
static int PutValue16(void *buffer, uint16_t value); // puts a 16-bit value into the buffer in big-endian format, returns number of bytes used(2)
|
||||
static int PutValueLE32(void *buffer, udp_uint value); // puts a 32-bit value in little-endian format
|
||||
|
||||
static udp_int64 GetValue64(const void *buffer); // gets a 64-bit value from the buffer in big-endian format
|
||||
static udp_uint GetValue32(const void *buffer); // gets a 32-bit value from the buffer in big-endian format
|
||||
static udp_uint GetValue24(const void *buffer); // gets a 24-bit value from the buffer in big-endian format
|
||||
static udp_ushort GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format
|
||||
static uint16_t GetValue16(const void *buffer); // gets a 16-bit value from the buffer in big-endian format
|
||||
|
||||
static LogicalPacket *CreateQuickLogicalPacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0);
|
||||
|
||||
@@ -151,7 +152,7 @@ inline udp_uint UdpMisc::GetValue24(const void *buffer)
|
||||
return((*bufptr << 16) | (*(bufptr + 1) << 8) | *(bufptr + 2));
|
||||
}
|
||||
|
||||
inline int UdpMisc::PutValue16(void *buffer, udp_ushort value)
|
||||
inline int UdpMisc::PutValue16(void *buffer, uint16_t value)
|
||||
{
|
||||
udp_uchar *bufptr = (udp_uchar *)buffer;
|
||||
*bufptr++ = (udp_uchar)((value >> 8) & 0xff);
|
||||
@@ -159,10 +160,10 @@ inline int UdpMisc::PutValue16(void *buffer, udp_ushort value)
|
||||
return(2);
|
||||
}
|
||||
|
||||
inline udp_ushort UdpMisc::GetValue16(const void *buffer)
|
||||
inline uint16_t UdpMisc::GetValue16(const void *buffer)
|
||||
{
|
||||
const udp_uchar *bufptr = (const udp_uchar *)buffer;
|
||||
return((udp_ushort)((*bufptr << 8) | *(bufptr + 1)));
|
||||
return((uint16_t)((*bufptr << 8) | *(bufptr + 1)));
|
||||
}
|
||||
|
||||
inline char *UdpMisc::Strncpy(char *dest, const char *source, int len)
|
||||
|
||||
+6
-6
@@ -387,7 +387,7 @@ int UdpReliableChannel::GiveTime()
|
||||
bufPtr = buf;
|
||||
*bufPtr++ = 0;
|
||||
*bufPtr++ = (udp_uchar)(((fragment) ? UdpConnection::cUdpPacketFragment1 : UdpConnection::cUdpPacketReliable1) + mChannelNumber); // mark us as a fragment if we are one
|
||||
bufPtr += UdpMisc::PutValue16(bufPtr, (udp_ushort)(reliableId & 0xffff));
|
||||
bufPtr += UdpMisc::PutValue16(bufPtr, (uint16_t)(reliableId & 0xffff));
|
||||
if (fragment && entry->mDataPtr == parentBase)
|
||||
bufPtr += UdpMisc::PutValue32(bufPtr, entry->mParent->GetDataLen()); // first fragment has a total-length byte after the reliable header
|
||||
mUdpConnection->BufferedSend(buf, (int)(bufPtr - buf), entry->mDataPtr, entry->mDataLen, false);
|
||||
@@ -570,7 +570,7 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen)
|
||||
}
|
||||
|
||||
int packetType = data[1];
|
||||
udp_ushort reliableStamp = UdpMisc::GetValue16(data + 2);
|
||||
uint16_t reliableStamp = UdpMisc::GetValue16(data + 2);
|
||||
udp_int64 reliableId = GetReliableIncomingId(reliableStamp);
|
||||
|
||||
if (reliableId >= mReliableIncomingId + mConfig.maxInstandingPackets)
|
||||
@@ -641,14 +641,14 @@ void UdpReliableChannel::ReliablePacket(const udp_uchar *data, int dataLen)
|
||||
{
|
||||
// ack everything up to the current head of our chain (minus one since the stamp represents the next one we want to get)
|
||||
*bufPtr++ = (udp_uchar)(UdpConnection::cUdpPacketAckAll1 + mChannelNumber);
|
||||
bufPtr += UdpMisc::PutValue16(bufPtr, (udp_ushort)((mReliableIncomingId - 1) & 0xffff));
|
||||
bufPtr += UdpMisc::PutValue16(bufPtr, (uint16_t)((mReliableIncomingId - 1) & 0xffff));
|
||||
ackAll = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// a simple ack for us only
|
||||
*bufPtr++ = (udp_uchar)(UdpConnection::cUdpPacketAck1 + mChannelNumber);
|
||||
bufPtr += UdpMisc::PutValue16(bufPtr, (udp_ushort)(reliableId & 0xffff));
|
||||
bufPtr += UdpMisc::PutValue16(bufPtr, (uint16_t)(reliableId & 0xffff));
|
||||
}
|
||||
|
||||
if (mBufferedAckPtr != nullptr && mConfig.ackDeduping && ackAll)
|
||||
@@ -742,7 +742,7 @@ void UdpReliableChannel::AckAllPacket(const udp_uchar *data, int dataLen)
|
||||
return;
|
||||
}
|
||||
|
||||
udp_int64 reliableId = GetReliableOutgoingId((udp_ushort)UdpMisc::GetValue16(data + 2));
|
||||
udp_int64 reliableId = GetReliableOutgoingId((uint16_t)UdpMisc::GetValue16(data + 2));
|
||||
|
||||
if (mReliableOutgoingPendingId > reliableId)
|
||||
{
|
||||
@@ -818,7 +818,7 @@ void UdpReliableChannel::Ack(udp_int64 reliableId)
|
||||
// harm done is that the we may not resend some of the earlier sent packets quite as quickly. This will only
|
||||
// happen in situations where a packet that was truely lost gets acked on it's second attempt...we just
|
||||
// won't be using that ack for the purposes of accelerating other resends...since odds are a non-lost packet
|
||||
// will accelerate those other resends shortly anyhow, there really is no loss
|
||||
// will accelerate those other resends int16_tly anyhow, there really is no loss
|
||||
// (note: we used to only set this value forward for packets that were never lost (one time sends); however, if this stamp
|
||||
// ever got set way high for some reason (in theory it can't happen), then we would get into a situation where it would
|
||||
// rapidly resend and possibly never get reset, causing infinite rapid resends, so we now set it every time to the first-stamp)
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@ inline void UdpReliableChannel::AckPacket(const udp_uchar *data, int dataLen)
|
||||
return;
|
||||
}
|
||||
|
||||
Ack(GetReliableOutgoingId((udp_ushort)UdpMisc::GetValue16(data + 2)));
|
||||
Ack(GetReliableOutgoingId((uint16_t)UdpMisc::GetValue16(data + 2)));
|
||||
}
|
||||
|
||||
inline int UdpReliableChannel::GetAveragePing() const
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// Copyright 2004 Sony Online Entertainment, all rights reserved.
|
||||
// Author: Jeff Petersen
|
||||
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
|
||||
namespace UdpLibrary
|
||||
@@ -22,8 +23,7 @@ class UdpPlatformAddress;
|
||||
#endif
|
||||
|
||||
typedef unsigned char udp_uchar;
|
||||
typedef unsigned short udp_ushort;
|
||||
typedef unsigned int udp_uint;
|
||||
typedef uint32_t udp_uint;
|
||||
typedef unsigned long udp_ulong;
|
||||
typedef udp_int64 UdpClockStamp;
|
||||
typedef UdpPlatformAddress UdpIpAddress; // deprecated, use UdpPlatformAddress directly instead
|
||||
|
||||
Reference in New Issue
Block a user