- Timestamp:
- May 26, 2008, 10:06:36 PM (16 years ago)
- Location:
- code/branches/network
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/TODO
r1293 r1432 1 very urgent: make sure receiver thread of connectionmanager is2 threadsafe (event_type_receive, findclient) -
code/branches/network/src/network/ClientInformation.h
r1431 r1432 48 48 #define GAMESTATEID_INITIAL -1 49 49 #define CLIENTID_UNKNOWN -2 50 51 // WATCH OUT: THE CLIENTINFORMATION LIST IS NOT THREADSAFE ANYMORE 50 52 51 53 namespace network -
code/branches/network/src/network/GameStateClient.cc
r1431 r1432 238 238 } 239 239 //retval->data = (unsigned char*)malloc(size); 240 if(size==0) 241 return NULL; 240 242 retval->data = new unsigned char[size]; 241 243 if(!retval->data){ … … 283 285 dest_length=diff->size; 284 286 // unsigned char *dp = (unsigned char *)malloc(dest_length*sizeof(unsigned char)); 287 if(dest_length==0) 288 return NULL; 285 289 unsigned char *dp = new unsigned char[dest_length*sizeof(unsigned char)]; 286 290 while(of<old->size && of<diff->size){ … … 322 326 323 327 uLongf buffer = (uLongf)((a->size + 12)*1.01)+1; 328 if(buffer==0) 329 return NULL; 324 330 unsigned char *dest = new unsigned char[buffer]; 325 331 int retval; … … 358 364 bufsize = normsize; 359 365 // unsigned char* dest = (unsigned char*)malloc( bufsize ); 366 if(bufsize==0) 367 return NULL; 360 368 unsigned char *dest = new unsigned char[bufsize]; 361 369 int retval; -
code/branches/network/src/network/GameStateManager.cc
r1431 r1432 193 193 } 194 194 //retval->data = (unsigned char*)malloc(size); 195 if(size==0) 196 return NULL; 195 197 retval->data = new unsigned char[size]; 196 198 if(!retval->data){ … … 347 349 else*/ 348 350 dest_length=neu->size; 351 if(dest_length==0) 352 return NULL; 349 353 //unsigned char *dp = (unsigned char *)malloc(dest_length*sizeof(unsigned char)); 350 354 unsigned char *dp = new unsigned char[dest_length*sizeof(unsigned char)]; … … 387 391 //COUT(4) << "size: " << size << ", buffer: " << buffer << std::endl; 388 392 //unsigned char* dest = (unsigned char*)malloc( buffer ); 393 if(buffer==0) 394 return NULL; 389 395 unsigned char *dest = new unsigned char[buffer]; 390 396 //COUT(4) << "dest: " << dest << std::endl; … … 429 435 bufsize = normsize; 430 436 // unsigned char* dest = (unsigned char*)malloc( bufsize ); 437 if(bufsize==0) 438 return NULL; 431 439 unsigned char *dest = new unsigned char[bufsize]; 432 440 int retval; -
code/branches/network/src/network/PacketDecoder.cc
r1360 r1432 127 127 bool PacketDecoder::command( ENetPacket* packet, int clientId ){ 128 128 int length = *(int*)((unsigned char *)packet->data+sizeof(int)); 129 if(length<=0) 130 return false; 129 131 void *data = (void *)new unsigned char[length]; 130 132 memcpy(data, (void *)(packet->data+2*sizeof(int)), length); … … 158 160 { 159 161 chat* chatting = new chat; 162 if(packet->dataLength==4) 163 return; 160 164 chatting->id = (int)*packet->data; //first copy id into new struct 161 165 //since the chat message is a char*, allocate the memory needed … … 204 208 COUT(2) << "PacketDecoder: compsize is 0" << std::endl; 205 209 // currentState->data = (unsigned char*)(malloc( currentState->compsize )); 210 if(currentState->compsize==0) 211 return; 206 212 currentState->data = new unsigned char[currentState->compsize]; 207 213 if(currentState->data==NULL) … … 221 227 cid->id = ((classid *)(packet->data))->id; 222 228 cid->clid = ((classid *)(packet->data))->clid; 229 if(cid->length==0) 230 return; 223 231 // cid->message = (const char *)malloc(cid->length); 224 232 cid->message = new char[cid->length]; -
code/branches/network/src/network/PacketGenerator.cc
r1360 r1432 89 89 ENetPacket* command( int dataLength, void *data, int reliable = ENET_PACKET_FLAG_RELIABLE ) 90 90 { 91 if(dataLength==0) 92 return NULL; 91 93 unsigned char *stream = new unsigned char[dataLength + 2*sizeof(int)]; 92 94 if(!stream) … … 150 152 //std::cout << "totalLen " << totalLen << std::endl; 151 153 //unsigned char *data = (unsigned char*)malloc( totalLen ); //allocate the memory for datastream 154 if(totalLen==0) 155 return NULL; 152 156 unsigned char *data = new unsigned char[totalLen]; 153 157 memcpy( (void*)(data), (const void*)&gid, sizeof( int ) ); //this is the enet id … … 173 177 { 174 178 //unsigned char* data = (unsigned char *)malloc(3*sizeof(int)+classname.length()+1); 179 if(classname.length()==0) 180 return NULL; 175 181 unsigned char *data = new unsigned char[3*sizeof(int)+classname.length()+1]; 176 182 std::cout << "PacketGenerator: classid: " << classid << ", name: " << classname << std::endl; -
code/branches/network/src/orxonox/Orxonox.cc
r1422 r1432 494 494 renderTime = 0.0f; 495 495 } 496 496 497 497 // Call those objects that need the real time 498 498 for (Iterator<TickableReal> it = ObjectList<TickableReal>::start(); it; ++it)
Note: See TracChangeset
for help on using the changeset viewer.