• Home
  • Raw
  • Download

Lines Matching refs:tsd

183   struct thread_sync_data tsd;  member
188 return &(((struct thread_data *)conn->async.os_specific)->tsd); in conn_thread_sync_data()
193 void destroy_thread_sync_data(struct thread_sync_data *tsd) in destroy_thread_sync_data() argument
195 if(tsd->mtx) { in destroy_thread_sync_data()
196 Curl_mutex_destroy(tsd->mtx); in destroy_thread_sync_data()
197 free(tsd->mtx); in destroy_thread_sync_data()
200 free(tsd->hostname); in destroy_thread_sync_data()
202 if(tsd->res) in destroy_thread_sync_data()
203 Curl_freeaddrinfo(tsd->res); in destroy_thread_sync_data()
210 if(tsd->sock_pair[1] != CURL_SOCKET_BAD) { in destroy_thread_sync_data()
211 sclose(tsd->sock_pair[1]); in destroy_thread_sync_data()
214 memset(tsd, 0, sizeof(*tsd)); in destroy_thread_sync_data()
224 struct thread_sync_data *tsd = &td->tsd; in init_thread_sync_data() local
226 memset(tsd, 0, sizeof(*tsd)); in init_thread_sync_data()
228 tsd->td = td; in init_thread_sync_data()
229 tsd->port = port; in init_thread_sync_data()
233 tsd->done = 1; in init_thread_sync_data()
236 tsd->hints = *hints; in init_thread_sync_data()
241 tsd->mtx = malloc(sizeof(curl_mutex_t)); in init_thread_sync_data()
242 if(tsd->mtx == NULL) in init_thread_sync_data()
245 Curl_mutex_init(tsd->mtx); in init_thread_sync_data()
249 if(Curl_socketpair(AF_UNIX, SOCK_STREAM, 0, &tsd->sock_pair[0]) < 0) { in init_thread_sync_data()
250 tsd->sock_pair[0] = CURL_SOCKET_BAD; in init_thread_sync_data()
251 tsd->sock_pair[1] = CURL_SOCKET_BAD; in init_thread_sync_data()
255 tsd->sock_error = CURL_ASYNC_SUCCESS; in init_thread_sync_data()
260 tsd->hostname = strdup(hostname); in init_thread_sync_data()
261 if(!tsd->hostname) in init_thread_sync_data()
268 destroy_thread_sync_data(tsd); in init_thread_sync_data()
274 struct thread_sync_data *tsd = conn_thread_sync_data(conn); in getaddrinfo_complete() local
277 rc = Curl_addrinfo_callback(conn, tsd->sock_error, tsd->res); in getaddrinfo_complete()
281 tsd->res = NULL; in getaddrinfo_complete()
297 struct thread_sync_data *tsd = (struct thread_sync_data*)arg; in getaddrinfo_thread() local
298 struct thread_data *td = tsd->td; in getaddrinfo_thread()
305 msnprintf(service, sizeof(service), "%d", tsd->port); in getaddrinfo_thread()
307 rc = Curl_getaddrinfo_ex(tsd->hostname, service, &tsd->hints, &tsd->res); in getaddrinfo_thread()
310 tsd->sock_error = SOCKERRNO?SOCKERRNO:rc; in getaddrinfo_thread()
311 if(tsd->sock_error == 0) in getaddrinfo_thread()
312 tsd->sock_error = RESOLVER_ENOMEM; in getaddrinfo_thread()
315 Curl_addrinfo_set_port(tsd->res, tsd->port); in getaddrinfo_thread()
318 Curl_mutex_acquire(tsd->mtx); in getaddrinfo_thread()
319 if(tsd->done) { in getaddrinfo_thread()
321 Curl_mutex_release(tsd->mtx); in getaddrinfo_thread()
322 destroy_thread_sync_data(tsd); in getaddrinfo_thread()
327 if(tsd->sock_pair[1] != CURL_SOCKET_BAD) { in getaddrinfo_thread()
330 if(swrite(tsd->sock_pair[1], buf, sizeof(buf)) < 0) { in getaddrinfo_thread()
332 tsd->sock_error = SOCKERRNO; in getaddrinfo_thread()
336 tsd->done = 1; in getaddrinfo_thread()
337 Curl_mutex_release(tsd->mtx); in getaddrinfo_thread()
350 struct thread_sync_data *tsd = (struct thread_sync_data *)arg; in gethostbyname_thread() local
351 struct thread_data *td = tsd->td; in gethostbyname_thread()
353 tsd->res = Curl_ipv4_resolve_r(tsd->hostname, tsd->port); in gethostbyname_thread()
355 if(!tsd->res) { in gethostbyname_thread()
356 tsd->sock_error = SOCKERRNO; in gethostbyname_thread()
357 if(tsd->sock_error == 0) in gethostbyname_thread()
358 tsd->sock_error = RESOLVER_ENOMEM; in gethostbyname_thread()
361 Curl_mutex_acquire(tsd->mtx); in gethostbyname_thread()
362 if(tsd->done) { in gethostbyname_thread()
364 Curl_mutex_release(tsd->mtx); in gethostbyname_thread()
365 destroy_thread_sync_data(tsd); in gethostbyname_thread()
369 tsd->done = 1; in gethostbyname_thread()
370 Curl_mutex_release(tsd->mtx); in gethostbyname_thread()
387 curl_socket_t sock_rd = td->tsd.sock_pair[0]; in destroy_async_data()
388 struct connectdata *conn = td->tsd.conn; in destroy_async_data()
395 Curl_mutex_acquire(td->tsd.mtx); in destroy_async_data()
396 done = td->tsd.done; in destroy_async_data()
397 td->tsd.done = 1; in destroy_async_data()
398 Curl_mutex_release(td->tsd.mtx); in destroy_async_data()
407 destroy_thread_sync_data(&td->tsd); in destroy_async_data()
462 td->tsd.done = 0; in init_resolve_thread()
465 td->thread_hnd = Curl_thread_create(getaddrinfo_thread, &td->tsd); in init_resolve_thread()
467 td->thread_hnd = Curl_thread_create(gethostbyname_thread, &td->tsd); in init_resolve_thread()
472 td->tsd.done = 1; in init_resolve_thread()
610 Curl_mutex_acquire(td->tsd.mtx); in Curl_resolver_is_resolved()
611 done = td->tsd.done; in Curl_resolver_is_resolved()
612 Curl_mutex_release(td->tsd.mtx); in Curl_resolver_is_resolved()
667 socks[0] = td->tsd.sock_pair[0]; in Curl_resolver_getsock()
668 DEBUGASSERT(td->tsd.conn == conn || !td->tsd.conn); in Curl_resolver_getsock()
669 td->tsd.conn = conn; in Curl_resolver_getsock()