| 123 | } |
| 124 | |
| 125 | U32 ConnectionStringTable::checkString(NetStringHandle &string, bool *isOnOtherSide) |
| 126 | { |
| 127 | // see if the entry is in the hash table right now |
| 128 | U32 hashIndex = string.getIndex() % EntryCount; |
| 129 | for(Entry *walk = mHashTable[hashIndex]; walk; walk = walk->nextHash) |
| 130 | { |
| 131 | if(walk->string == string) |
| 132 | { |
| 133 | pushBack(walk); |
| 134 | if(isOnOtherSide) |
| 135 | *isOnOtherSide = walk->receiveConfirmed; |
| 136 | return walk->index; |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | // not in the hash table, means we have to add it |
| 141 | Entry *newEntry; |
| 142 | |
| 143 | // pull the new entry from the LRU list. |
| 144 | newEntry = mLRUHead.nextLink; |
| 145 | pushBack(newEntry); |
| 146 | |
| 147 | // remove the string from the hash table |
| 148 | Entry **hashWalk; |
| 149 | for (hashWalk = &mHashTable[newEntry->string.getIndex() % EntryCount]; *hashWalk; hashWalk = &((*hashWalk)->nextHash)) |
| 150 | { |
| 151 | if(*hashWalk == newEntry) |
| 152 | { |
| 153 | *hashWalk = newEntry->nextHash; |
| 154 | break; |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | newEntry->string = string; |
| 159 | newEntry->receiveConfirmed = false; |
| 160 | newEntry->nextHash = mHashTable[hashIndex]; |
| 161 | mHashTable[hashIndex] = newEntry; |
| 162 | |
| 163 | mParent->postNetEvent(new NetStringEvent(newEntry->index, string)); |
| 164 | if(isOnOtherSide) |
| 165 | *isOnOtherSide = false; |
| 166 | return newEntry->index; |
| 167 | } |
| 168 | |
| 169 | void ConnectionStringTable::mapString(U32 netId, NetStringHandle &string) |
| 170 | { |
nothing calls this directly
no test coverage detected