Lines Matching full:rc

83 	struct rc_data *rc = NULL;	/* private data */  in clnt_reconnect_create()  local
91 rc = mem_alloc(sizeof (*rc)); in clnt_reconnect_create()
92 mtx_init(&rc->rc_lock, "rc->rc_lock", NULL, MTX_DEF); in clnt_reconnect_create()
93 (void) memcpy(&rc->rc_addr, svcaddr, (size_t)svcaddr->sa_len); in clnt_reconnect_create()
94 rc->rc_nconf = nconf; in clnt_reconnect_create()
95 rc->rc_prog = program; in clnt_reconnect_create()
96 rc->rc_vers = version; in clnt_reconnect_create()
97 rc->rc_sendsz = sendsz; in clnt_reconnect_create()
98 rc->rc_recvsz = recvsz; in clnt_reconnect_create()
99 rc->rc_timeout.tv_sec = -1; in clnt_reconnect_create()
100 rc->rc_timeout.tv_usec = -1; in clnt_reconnect_create()
101 rc->rc_retry.tv_sec = 3; in clnt_reconnect_create()
102 rc->rc_retry.tv_usec = 0; in clnt_reconnect_create()
103 rc->rc_retries = INT_MAX; in clnt_reconnect_create()
104 rc->rc_privport = FALSE; in clnt_reconnect_create()
105 rc->rc_waitchan = "rpcrecv"; in clnt_reconnect_create()
106 rc->rc_intr = 0; in clnt_reconnect_create()
107 rc->rc_connecting = FALSE; in clnt_reconnect_create()
108 rc->rc_closed = FALSE; in clnt_reconnect_create()
109 rc->rc_ucred = crdup(curthread->td_ucred); in clnt_reconnect_create()
110 rc->rc_client = NULL; in clnt_reconnect_create()
111 rc->rc_tls = false; in clnt_reconnect_create()
112 rc->rc_tlscertname = NULL; in clnt_reconnect_create()
113 rc->rc_reconcall = NULL; in clnt_reconnect_create()
114 rc->rc_reconarg = NULL; in clnt_reconnect_create()
118 cl->cl_private = (caddr_t)(void *)rc; in clnt_reconnect_create()
129 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_connect() local
139 mtx_lock(&rc->rc_lock); in clnt_reconnect_connect()
140 while (rc->rc_connecting) { in clnt_reconnect_connect()
141 error = msleep(rc, &rc->rc_lock, in clnt_reconnect_connect()
142 rc->rc_intr ? PCATCH : 0, "rpcrecon", 0); in clnt_reconnect_connect()
144 mtx_unlock(&rc->rc_lock); in clnt_reconnect_connect()
148 if (rc->rc_closed) { in clnt_reconnect_connect()
149 mtx_unlock(&rc->rc_lock); in clnt_reconnect_connect()
152 if (rc->rc_client) { in clnt_reconnect_connect()
153 mtx_unlock(&rc->rc_lock); in clnt_reconnect_connect()
163 rc->rc_connecting = TRUE; in clnt_reconnect_connect()
164 mtx_unlock(&rc->rc_lock); in clnt_reconnect_connect()
167 td->td_ucred = rc->rc_ucred; in clnt_reconnect_connect()
168 so = __rpc_nconf2socket(rc->rc_nconf); in clnt_reconnect_connect()
176 if (rc->rc_privport) in clnt_reconnect_connect()
179 if (rc->rc_nconf->nc_semantics == NC_TPI_CLTS) in clnt_reconnect_connect()
181 (struct sockaddr *) &rc->rc_addr, rc->rc_prog, rc->rc_vers, in clnt_reconnect_connect()
182 rc->rc_sendsz, rc->rc_recvsz); in clnt_reconnect_connect()
189 if (rc->rc_timeout.tv_sec > 0 && rc->rc_timeout.tv_usec >= 0) { in clnt_reconnect_connect()
191 &rc->rc_timeout, sizeof(struct timeval)); in clnt_reconnect_connect()
200 (struct sockaddr *) &rc->rc_addr, rc->rc_prog, rc->rc_vers, in clnt_reconnect_connect()
201 rc->rc_sendsz, rc->rc_recvsz, rc->rc_intr); in clnt_reconnect_connect()
202 if (rc->rc_tls && newclient != NULL) { in clnt_reconnect_connect()
203 stat = rpctls_connect(newclient, rc->rc_tlscertname, so, in clnt_reconnect_connect()
223 if (newclient != NULL && rc->rc_reconcall != NULL) in clnt_reconnect_connect()
224 (*rc->rc_reconcall)(newclient, rc->rc_reconarg, in clnt_reconnect_connect()
225 rc->rc_ucred); in clnt_reconnect_connect()
231 rc->rc_err = rpc_createerr.cf_error; in clnt_reconnect_connect()
238 CLNT_CONTROL(newclient, CLSET_TIMEOUT, &rc->rc_timeout); in clnt_reconnect_connect()
239 CLNT_CONTROL(newclient, CLSET_RETRY_TIMEOUT, &rc->rc_retry); in clnt_reconnect_connect()
240 CLNT_CONTROL(newclient, CLSET_WAITCHAN, rc->rc_waitchan); in clnt_reconnect_connect()
241 CLNT_CONTROL(newclient, CLSET_INTERRUPTIBLE, &rc->rc_intr); in clnt_reconnect_connect()
242 if (rc->rc_tls) in clnt_reconnect_connect()
244 if (rc->rc_backchannel != NULL) in clnt_reconnect_connect()
245 CLNT_CONTROL(newclient, CLSET_BACKCHANNEL, rc->rc_backchannel); in clnt_reconnect_connect()
249 mtx_lock(&rc->rc_lock); in clnt_reconnect_connect()
250 KASSERT(rc->rc_client == NULL, ("rc_client not null")); in clnt_reconnect_connect()
251 if (!rc->rc_closed) { in clnt_reconnect_connect()
252 rc->rc_client = newclient; in clnt_reconnect_connect()
255 rc->rc_connecting = FALSE; in clnt_reconnect_connect()
256 wakeup(rc); in clnt_reconnect_connect()
257 mtx_unlock(&rc->rc_lock); in clnt_reconnect_connect()
282 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_call() local
289 mtx_lock(&rc->rc_lock); in clnt_reconnect_call()
290 if (rc->rc_closed) { in clnt_reconnect_call()
291 mtx_unlock(&rc->rc_lock); in clnt_reconnect_call()
295 if (!rc->rc_client) { in clnt_reconnect_call()
296 mtx_unlock(&rc->rc_lock); in clnt_reconnect_call()
300 rc->rc_intr ? PCATCH : 0, "rpccon", hz); in clnt_reconnect_call()
304 if (tries >= rc->rc_retries) in clnt_reconnect_call()
310 mtx_lock(&rc->rc_lock); in clnt_reconnect_call()
313 if (!rc->rc_client) { in clnt_reconnect_call()
314 mtx_unlock(&rc->rc_lock); in clnt_reconnect_call()
318 CLNT_ACQUIRE(rc->rc_client); in clnt_reconnect_call()
319 client = rc->rc_client; in clnt_reconnect_call()
320 mtx_unlock(&rc->rc_lock); in clnt_reconnect_call()
326 CLNT_GETERR(client, &rc->rc_err); in clnt_reconnect_call()
334 if ((rc->rc_timeout.tv_sec == 0 in clnt_reconnect_call()
335 && rc->rc_timeout.tv_usec == 0) in clnt_reconnect_call()
336 || (rc->rc_timeout.tv_sec == -1 in clnt_reconnect_call()
347 if (tries >= rc->rc_retries) { in clnt_reconnect_call()
356 mtx_lock(&rc->rc_lock); in clnt_reconnect_call()
365 if (rc->rc_client == client) { in clnt_reconnect_call()
366 rc->rc_client = NULL; in clnt_reconnect_call()
367 mtx_unlock(&rc->rc_lock); in clnt_reconnect_call()
370 mtx_unlock(&rc->rc_lock); in clnt_reconnect_call()
388 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_geterr() local
390 *errp = rc->rc_err; in clnt_reconnect_geterr()
400 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_freeres() local
402 return (CLNT_FREERES(rc->rc_client, xdr_res, res_ptr)); in clnt_reconnect_freeres()
418 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_control() local
428 rc->rc_timeout = *(struct timeval *)info; in clnt_reconnect_control()
429 if (rc->rc_client) in clnt_reconnect_control()
430 CLNT_CONTROL(rc->rc_client, request, info); in clnt_reconnect_control()
434 *(struct timeval *)info = rc->rc_timeout; in clnt_reconnect_control()
438 rc->rc_retry = *(struct timeval *)info; in clnt_reconnect_control()
439 if (rc->rc_client) in clnt_reconnect_control()
440 CLNT_CONTROL(rc->rc_client, request, info); in clnt_reconnect_control()
444 *(struct timeval *)info = rc->rc_retry; in clnt_reconnect_control()
448 *(uint32_t *)info = rc->rc_vers; in clnt_reconnect_control()
452 rc->rc_vers = *(uint32_t *) info; in clnt_reconnect_control()
453 if (rc->rc_client) in clnt_reconnect_control()
454 CLNT_CONTROL(rc->rc_client, CLSET_VERS, info); in clnt_reconnect_control()
458 *(uint32_t *)info = rc->rc_prog; in clnt_reconnect_control()
462 rc->rc_prog = *(uint32_t *) info; in clnt_reconnect_control()
463 if (rc->rc_client) in clnt_reconnect_control()
464 CLNT_CONTROL(rc->rc_client, request, info); in clnt_reconnect_control()
468 rc->rc_waitchan = (char *)info; in clnt_reconnect_control()
469 if (rc->rc_client) in clnt_reconnect_control()
470 CLNT_CONTROL(rc->rc_client, request, info); in clnt_reconnect_control()
474 *(const char **) info = rc->rc_waitchan; in clnt_reconnect_control()
478 rc->rc_intr = *(int *) info; in clnt_reconnect_control()
479 if (rc->rc_client) in clnt_reconnect_control()
480 CLNT_CONTROL(rc->rc_client, request, info); in clnt_reconnect_control()
484 *(int *) info = rc->rc_intr; in clnt_reconnect_control()
488 rc->rc_retries = *(int *) info; in clnt_reconnect_control()
492 *(int *) info = rc->rc_retries; in clnt_reconnect_control()
496 rc->rc_privport = *(int *) info; in clnt_reconnect_control()
500 *(int *) info = rc->rc_privport; in clnt_reconnect_control()
506 rc->rc_backchannel = info; in clnt_reconnect_control()
510 rc->rc_tls = true; in clnt_reconnect_control()
523 rc->rc_tlscertname = mem_alloc(slen); in clnt_reconnect_control()
524 strlcpy(rc->rc_tlscertname, info, slen); in clnt_reconnect_control()
529 rc->rc_reconcall = upcp->call; in clnt_reconnect_control()
530 rc->rc_reconarg = upcp->arg; in clnt_reconnect_control()
543 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_close() local
546 mtx_lock(&rc->rc_lock); in clnt_reconnect_close()
548 if (rc->rc_closed) { in clnt_reconnect_close()
549 mtx_unlock(&rc->rc_lock); in clnt_reconnect_close()
553 rc->rc_closed = TRUE; in clnt_reconnect_close()
554 client = rc->rc_client; in clnt_reconnect_close()
555 rc->rc_client = NULL; in clnt_reconnect_close()
557 mtx_unlock(&rc->rc_lock); in clnt_reconnect_close()
568 struct rc_data *rc = (struct rc_data *)cl->cl_private; in clnt_reconnect_destroy() local
571 if (rc->rc_client) in clnt_reconnect_destroy()
572 CLNT_DESTROY(rc->rc_client); in clnt_reconnect_destroy()
573 if (rc->rc_backchannel) { in clnt_reconnect_destroy()
574 xprt = (SVCXPRT *)rc->rc_backchannel; in clnt_reconnect_destroy()
580 crfree(rc->rc_ucred); in clnt_reconnect_destroy()
581 mtx_destroy(&rc->rc_lock); in clnt_reconnect_destroy()
582 mem_free(rc->rc_tlscertname, 0); /* 0 ok, since arg. ignored. */ in clnt_reconnect_destroy()
583 mem_free(rc->rc_reconarg, 0); in clnt_reconnect_destroy()
584 mem_free(rc, sizeof(*rc)); in clnt_reconnect_destroy()