| 223 |
223 |
| 224 return FALSE; |
224 return FALSE; |
| 225 } |
225 } |
| 226 |
226 |
| 227 static gpointer res_thread(gpointer data) { |
227 static gpointer res_thread(gpointer data) { |
| 228 DNS_RECORD *dr = NULL; |
228 PDNS_RECORD *dr = NULL; |
| 229 GSList *lst = NULL; |
229 GSList *lst = NULL; |
| 230 struct srv_response *srvres; |
230 struct srv_response *srvres; |
| 231 DNS_SRV_DATA *srv_data; |
231 DNS_SRV_DATA *srv_data; |
| 232 int type = DNS_TYPE_SRV; |
232 int type = DNS_TYPE_SRV; |
| 233 DNS_STATUS ds; |
233 DNS_STATUS ds; |
| 234 struct resdata *rdata = data; |
234 struct resdata *rdata = data; |
| 235 |
235 |
| 236 ds = MyDnsQuery_UTF8(rdata->query, type, DNS_QUERY_STANDARD, NULL, &dr, NULL); |
236 ds = MyDnsQuery_UTF8(rdata->query, type, DNS_QUERY_STANDARD, NULL, dr, NULL); |
| 237 if (ds != ERROR_SUCCESS) { |
237 if (ds != ERROR_SUCCESS) { |
| 238 rdata->errmsg = g_strdup_printf("Couldn't look up SRV record. Error = %d\n", (int) ds); |
238 rdata->errmsg = g_strdup_printf("Couldn't look up SRV record. Error = %d\n", (int) ds); |
| 239 } else { |
239 } else { |
| 240 DNS_RECORD *dr_tmp = dr; |
240 DNS_RECORD *dr_tmp = *dr; |
| 241 while (dr_tmp != NULL) { |
241 while (dr_tmp != NULL) { |
| 242 /* Discard any incorrect entries. I'm not sure if this is necessary */ |
242 /* Discard any incorrect entries. I'm not sure if this is necessary */ |
| 243 if (dr_tmp->wType != type || strcmp(dr_tmp->pName, rdata->query) != 0) { |
243 if (dr_tmp->wType != type || strcmp(dr_tmp->pName, rdata->query) != 0) { |
| 244 dr_tmp = dr_tmp->pNext; |
244 dr_tmp = dr_tmp->pNext; |
| 245 continue; |
245 continue; |
| 256 lst = g_slist_insert_sorted(lst, srvres, responsecompare); |
256 lst = g_slist_insert_sorted(lst, srvres, responsecompare); |
| 257 |
257 |
| 258 dr_tmp = dr_tmp->pNext; |
258 dr_tmp = dr_tmp->pNext; |
| 259 } |
259 } |
| 260 |
260 |
| 261 MyDnsRecordListFree(dr, DnsFreeRecordList); |
261 MyDnsRecordListFree(*dr, DnsFreeRecordList); |
| 262 rdata->results = lst; |
262 rdata->results = lst; |
| 263 } |
263 } |
| 264 |
264 |
| 265 /* back to main thread */ |
265 /* back to main thread */ |
| 266 g_idle_add(res_main_thread_cb, rdata); |
266 g_idle_add(res_main_thread_cb, rdata); |