| 163 | } |
| 164 | |
| 165 | bool NetAsync::checkLookup(NetSocket socket, void* out_h_addr, |
| 166 | int* out_h_length, int out_h_addr_size) |
| 167 | { |
| 168 | lockNetAsyncMutex(); |
| 169 | bool found = false; |
| 170 | // search for the socket |
| 171 | Vector<NameLookupRequest*>::iterator iter; |
| 172 | for (iter = mLookupRequests.begin(); |
| 173 | iter != mLookupRequests.end(); |
| 174 | ++iter) |
| 175 | // if we found it and it is complete... |
| 176 | if (socket == (*iter)->sock && (*iter)->complete) |
| 177 | { |
| 178 | // copy the lookup data to the callers parameters |
| 179 | dMemcpy(out_h_addr, (*iter)->out_h_addr, out_h_addr_size); |
| 180 | *out_h_length = (*iter)->out_h_length; |
| 181 | found = true; |
| 182 | break; |
| 183 | } |
| 184 | |
| 185 | // we found the socket, so we are done with it. erase. |
| 186 | if (found) |
| 187 | { |
| 188 | delete *iter; |
| 189 | mLookupRequests.erase(iter); |
| 190 | } |
| 191 | unlockNetAsyncMutex(); |
| 192 | |
| 193 | return found; |
| 194 | } |
| 195 | |
| 196 | // this is called by the pthread module to start the thread |
| 197 | static void StartThreadFunc(S32 nothing) |
no test coverage detected