Lines Matching refs:tsd
178 struct thread_sync_data tsd; member
183 return &(((struct thread_data *)conn->async.os_specific)->tsd); in conn_thread_sync_data()
188 void destroy_thread_sync_data(struct thread_sync_data * tsd) in destroy_thread_sync_data() argument
190 if(tsd->mtx) { in destroy_thread_sync_data()
191 Curl_mutex_destroy(tsd->mtx); in destroy_thread_sync_data()
192 free(tsd->mtx); in destroy_thread_sync_data()
195 free(tsd->hostname); in destroy_thread_sync_data()
197 if(tsd->res) in destroy_thread_sync_data()
198 Curl_freeaddrinfo(tsd->res); in destroy_thread_sync_data()
200 memset(tsd, 0, sizeof(*tsd)); in destroy_thread_sync_data()
210 struct thread_sync_data *tsd = &td->tsd; in init_thread_sync_data() local
212 memset(tsd, 0, sizeof(*tsd)); in init_thread_sync_data()
214 tsd->td = td; in init_thread_sync_data()
215 tsd->port = port; in init_thread_sync_data()
219 tsd->done = 1; in init_thread_sync_data()
222 tsd->hints = *hints; in init_thread_sync_data()
227 tsd->mtx = malloc(sizeof(curl_mutex_t)); in init_thread_sync_data()
228 if(tsd->mtx == NULL) in init_thread_sync_data()
231 Curl_mutex_init(tsd->mtx); in init_thread_sync_data()
233 tsd->sock_error = CURL_ASYNC_SUCCESS; in init_thread_sync_data()
238 tsd->hostname = strdup(hostname); in init_thread_sync_data()
239 if(!tsd->hostname) in init_thread_sync_data()
246 destroy_thread_sync_data(tsd); in init_thread_sync_data()
252 struct thread_sync_data *tsd = conn_thread_sync_data(conn); in getaddrinfo_complete() local
255 rc = Curl_addrinfo_callback(conn, tsd->sock_error, tsd->res); in getaddrinfo_complete()
259 tsd->res = NULL; in getaddrinfo_complete()
275 struct thread_sync_data *tsd = (struct thread_sync_data*)arg; in getaddrinfo_thread() local
276 struct thread_data *td = tsd->td; in getaddrinfo_thread()
280 msnprintf(service, sizeof(service), "%d", tsd->port); in getaddrinfo_thread()
282 rc = Curl_getaddrinfo_ex(tsd->hostname, service, &tsd->hints, &tsd->res); in getaddrinfo_thread()
285 tsd->sock_error = SOCKERRNO?SOCKERRNO:rc; in getaddrinfo_thread()
286 if(tsd->sock_error == 0) in getaddrinfo_thread()
287 tsd->sock_error = RESOLVER_ENOMEM; in getaddrinfo_thread()
290 Curl_addrinfo_set_port(tsd->res, tsd->port); in getaddrinfo_thread()
293 Curl_mutex_acquire(tsd->mtx); in getaddrinfo_thread()
294 if(tsd->done) { in getaddrinfo_thread()
296 Curl_mutex_release(tsd->mtx); in getaddrinfo_thread()
297 destroy_thread_sync_data(tsd); in getaddrinfo_thread()
301 tsd->done = 1; in getaddrinfo_thread()
302 Curl_mutex_release(tsd->mtx); in getaddrinfo_thread()
315 struct thread_sync_data *tsd = (struct thread_sync_data *)arg; in gethostbyname_thread() local
316 struct thread_data *td = tsd->td; in gethostbyname_thread()
318 tsd->res = Curl_ipv4_resolve_r(tsd->hostname, tsd->port); in gethostbyname_thread()
320 if(!tsd->res) { in gethostbyname_thread()
321 tsd->sock_error = SOCKERRNO; in gethostbyname_thread()
322 if(tsd->sock_error == 0) in gethostbyname_thread()
323 tsd->sock_error = RESOLVER_ENOMEM; in gethostbyname_thread()
326 Curl_mutex_acquire(tsd->mtx); in gethostbyname_thread()
327 if(tsd->done) { in gethostbyname_thread()
329 Curl_mutex_release(tsd->mtx); in gethostbyname_thread()
330 destroy_thread_sync_data(tsd); in gethostbyname_thread()
334 tsd->done = 1; in gethostbyname_thread()
335 Curl_mutex_release(tsd->mtx); in gethostbyname_thread()
356 Curl_mutex_acquire(td->tsd.mtx); in destroy_async_data()
357 done = td->tsd.done; in destroy_async_data()
358 td->tsd.done = 1; in destroy_async_data()
359 Curl_mutex_release(td->tsd.mtx); in destroy_async_data()
368 destroy_thread_sync_data(&td->tsd); in destroy_async_data()
414 td->tsd.done = 0; in init_resolve_thread()
417 td->thread_hnd = Curl_thread_create(getaddrinfo_thread, &td->tsd); in init_resolve_thread()
419 td->thread_hnd = Curl_thread_create(gethostbyname_thread, &td->tsd); in init_resolve_thread()
424 td->tsd.done = 1; in init_resolve_thread()
555 Curl_mutex_acquire(td->tsd.mtx); in Curl_resolver_is_resolved()
556 done = td->tsd.done; in Curl_resolver_is_resolved()
557 Curl_mutex_release(td->tsd.mtx); in Curl_resolver_is_resolved()