llpacketack.cpp

Go to the documentation of this file.
00001 
00034 #include "linden_common.h"
00035 #include "llpacketack.h"
00036 
00037 #if !LL_WINDOWS
00038 #include <netinet/in.h>
00039 #else
00040 #include "winsock2.h"
00041 #endif
00042 
00043 #include "message.h"
00044 
00045 LLReliablePacket::LLReliablePacket(
00046         S32 socket,
00047         U8* buf_ptr,
00048         S32 buf_len,
00049         LLReliablePacketParams* params) :
00050         mBuffer(NULL),
00051         mBufferLength(0)
00052 {
00053         if (params)
00054         {
00055                 mHost = params->mHost;
00056                 mRetries = params->mRetries;
00057                 mPingBasedRetry = params->mPingBasedRetry;
00058                 mTimeout = params->mTimeout;
00059                 mCallback = params->mCallback;
00060                 mCallbackData = params->mCallbackData;
00061                 mMessageName = params->mMessageName;
00062         }
00063         else
00064         {
00065                 mRetries = 0;
00066                 mPingBasedRetry = TRUE;
00067                 mTimeout = 0.f;
00068                 mCallback = NULL;
00069                 mCallbackData = NULL;
00070                 mMessageName = NULL;
00071         }
00072 
00073         mExpirationTime = (F64)((S64)totalTime())/1000000.0 + mTimeout;
00074         mPacketID = ntohl(*((U32*)(&buf_ptr[PHL_PACKET_ID])));
00075 
00076         mSocket = socket;
00077         if (mRetries)
00078         {
00079                 mBuffer = new U8[buf_len];
00080                 if (mBuffer != NULL)
00081                 {
00082                         memcpy(mBuffer,buf_ptr,buf_len);        /*Flawfinder: ignore*/
00083                         mBufferLength = buf_len;
00084                 }
00085                         
00086         }
00087 }

Generated on Thu Jul 1 06:08:55 2010 for Second Life Viewer by  doxygen 1.4.7