Lines Matching refs:tsd

171   struct thread_sync_data tsd;  member
176 return &(data->state.async.tdata->tsd); in conn_thread_sync_data()
181 void destroy_thread_sync_data(struct thread_sync_data *tsd) in destroy_thread_sync_data() argument
183 if(tsd->mtx) { in destroy_thread_sync_data()
184 Curl_mutex_destroy(tsd->mtx); in destroy_thread_sync_data()
185 free(tsd->mtx); in destroy_thread_sync_data()
188 free(tsd->hostname); in destroy_thread_sync_data()
190 if(tsd->res) in destroy_thread_sync_data()
191 Curl_freeaddrinfo(tsd->res); in destroy_thread_sync_data()
198 if(tsd->sock_pair[1] != CURL_SOCKET_BAD) { in destroy_thread_sync_data()
199 wakeup_close(tsd->sock_pair[1]); in destroy_thread_sync_data()
202 memset(tsd, 0, sizeof(*tsd)); in destroy_thread_sync_data()
212 struct thread_sync_data *tsd = &td->tsd; in init_thread_sync_data() local
214 memset(tsd, 0, sizeof(*tsd)); in init_thread_sync_data()
216 tsd->td = td; in init_thread_sync_data()
217 tsd->port = port; in init_thread_sync_data()
221 tsd->done = 1; in init_thread_sync_data()
224 tsd->hints = *hints; in init_thread_sync_data()
229 tsd->mtx = malloc(sizeof(curl_mutex_t)); in init_thread_sync_data()
230 if(!tsd->mtx) in init_thread_sync_data()
233 Curl_mutex_init(tsd->mtx); in init_thread_sync_data()
237 if(wakeup_create(tsd->sock_pair, FALSE) < 0) { in init_thread_sync_data()
238 tsd->sock_pair[0] = CURL_SOCKET_BAD; in init_thread_sync_data()
239 tsd->sock_pair[1] = CURL_SOCKET_BAD; in init_thread_sync_data()
243 tsd->sock_error = CURL_ASYNC_SUCCESS; in init_thread_sync_data()
248 tsd->hostname = strdup(hostname); in init_thread_sync_data()
249 if(!tsd->hostname) in init_thread_sync_data()
256 if(tsd->sock_pair[0] != CURL_SOCKET_BAD) { in init_thread_sync_data()
257 wakeup_close(tsd->sock_pair[0]); in init_thread_sync_data()
258 tsd->sock_pair[0] = CURL_SOCKET_BAD; in init_thread_sync_data()
261 destroy_thread_sync_data(tsd); in init_thread_sync_data()
267 struct thread_sync_data *tsd = conn_thread_sync_data(data); in getaddrinfo_complete() local
270 result = Curl_addrinfo_callback(data, tsd->sock_error, tsd->res); in getaddrinfo_complete()
274 tsd->res = NULL; in getaddrinfo_complete()
296 struct thread_sync_data *tsd = (struct thread_sync_data *)arg; in getaddrinfo_thread() local
297 struct thread_data *td = tsd->td; in getaddrinfo_thread()
309 msnprintf(service, sizeof(service), "%d", tsd->port); in getaddrinfo_thread()
311 rc = Curl_getaddrinfo_ex(tsd->hostname, service, &tsd->hints, &tsd->res); in getaddrinfo_thread()
314 tsd->sock_error = SOCKERRNO ? SOCKERRNO : rc; in getaddrinfo_thread()
315 if(tsd->sock_error == 0) in getaddrinfo_thread()
316 tsd->sock_error = RESOLVER_ENOMEM; in getaddrinfo_thread()
319 Curl_addrinfo_set_port(tsd->res, tsd->port); in getaddrinfo_thread()
322 Curl_mutex_acquire(tsd->mtx); in getaddrinfo_thread()
323 if(tsd->done) { in getaddrinfo_thread()
325 Curl_mutex_release(tsd->mtx); in getaddrinfo_thread()
326 destroy_thread_sync_data(tsd); in getaddrinfo_thread()
331 if(tsd->sock_pair[1] != CURL_SOCKET_BAD) { in getaddrinfo_thread()
338 if(wakeup_write(tsd->sock_pair[1], buf, sizeof(buf)) < 0) { in getaddrinfo_thread()
340 tsd->sock_error = SOCKERRNO; in getaddrinfo_thread()
344 tsd->done = 1; in getaddrinfo_thread()
345 Curl_mutex_release(tsd->mtx); in getaddrinfo_thread()
364 struct thread_sync_data *tsd = (struct thread_sync_data *)arg; in gethostbyname_thread() local
365 struct thread_data *td = tsd->td; in gethostbyname_thread()
367 tsd->res = Curl_ipv4_resolve_r(tsd->hostname, tsd->port); in gethostbyname_thread()
369 if(!tsd->res) { in gethostbyname_thread()
370 tsd->sock_error = SOCKERRNO; in gethostbyname_thread()
371 if(tsd->sock_error == 0) in gethostbyname_thread()
372 tsd->sock_error = RESOLVER_ENOMEM; in gethostbyname_thread()
375 Curl_mutex_acquire(tsd->mtx); in gethostbyname_thread()
376 if(tsd->done) { in gethostbyname_thread()
378 Curl_mutex_release(tsd->mtx); in gethostbyname_thread()
379 destroy_thread_sync_data(tsd); in gethostbyname_thread()
383 tsd->done = 1; in gethostbyname_thread()
384 Curl_mutex_release(tsd->mtx); in gethostbyname_thread()
401 curl_socket_t sock_rd = td->tsd.sock_pair[0]; in destroy_async_data()
402 struct Curl_easy *data = td->tsd.data; in destroy_async_data()
409 Curl_mutex_acquire(td->tsd.mtx); in destroy_async_data()
410 done = td->tsd.done; in destroy_async_data()
411 td->tsd.done = 1; in destroy_async_data()
412 Curl_mutex_release(td->tsd.mtx); in destroy_async_data()
421 destroy_thread_sync_data(&td->tsd); in destroy_async_data()
476 td->tsd.done = 0; in init_resolve_thread()
479 td->thread_hnd = Curl_thread_create(getaddrinfo_thread, &td->tsd); in init_resolve_thread()
481 td->thread_hnd = Curl_thread_create(gethostbyname_thread, &td->tsd); in init_resolve_thread()
486 td->tsd.done = 1; in init_resolve_thread()
598 Curl_mutex_acquire(td->tsd.mtx); in Curl_resolver_is_resolved()
599 done = td->tsd.done; in Curl_resolver_is_resolved()
600 Curl_mutex_release(td->tsd.mtx); in Curl_resolver_is_resolved()
653 socks[0] = td->tsd.sock_pair[0]; in Curl_resolver_getsock()
654 td->tsd.data = data; in Curl_resolver_getsock()