Changeset 1502 for code/trunk/src/network/PacketBuffer.cc
- Timestamp:
- Jun 1, 2008, 3:54:20 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/network/PacketBuffer.cc
r1360 r1502 62 62 last->next=NULL; 63 63 // change this!!!!!!! ---- we are not doing stl so we won't change this 64 last->packet = ev->packet; 65 last->address = ev->peer->address; 64 last->event = ev; 66 65 //last->address = ev->peer->address; 67 66 } else { … … 72 71 last->next=NULL; 73 72 // save the packet to the new element 74 last->packet = ev->packet; 75 last->address = ev->peer->address; 73 last->event = ev; 76 74 //last->address = ev->peer->address; 77 75 } … … 82 80 //returns the first element in the list without deleting it but 83 81 //moving first pointer to next element 84 ENetPacket *PacketBuffer::pop() {82 /*ENetPacket *PacketBuffer::pop() { 85 83 ENetAddress address; 86 84 return pop(address); 87 } 88 89 ENet Packet *PacketBuffer::pop(ENetAddress &address){85 }*/ 86 87 ENetEvent *PacketBuffer::pop(){ 90 88 boost::recursive_mutex::scoped_lock lock(mutex_); 91 89 //std::cout << "packetbuffer pop(address)" << std::endl; … … 93 91 QueueItem *temp = first; 94 92 // get packet 95 ENetPacket *pck=first->packet; 96 address = first->address; 93 ENetEvent *ev=first->event; 94 //address = first->address; 95 // remove first element 96 first = first->next; 97 delete temp; 98 lock.unlock(); 99 //std::cout << "pop(address) size of packet " << pck->dataLength << std::endl; 100 return ev; 101 } else{ 102 lock.unlock(); 103 return NULL; 104 } 105 } 106 107 /*ENetPacket *PacketBuffer::pop(ENetAddress &address) { 108 boost::recursive_mutex::scoped_lock lock(mutex_); 109 //std::cout << "packetbuffer pop(address)" << std::endl; 110 if(first!=NULL ){ 111 QueueItem *temp = first; 112 // get packet 113 ENetPacket *pck=first->event->packet; 114 address = first->event->peer->address; 97 115 // remove first element 98 116 first = first->next; … … 105 123 return NULL; 106 124 } 107 } 125 }*/ 108 126 109 127 bool PacketBuffer::isEmpty() {
Note: See TracChangeset
for help on using the changeset viewer.