Lines Matching defs:conn

164 maybe_free_connection(controlconnection_t *conn) {
165 controllistener_t *listener = conn->listener;
167 if (conn->timer != NULL)
168 isc_timer_detach(&conn->timer);
170 if (conn->ccmsg_valid) {
171 isccc_ccmsg_cancelread(&conn->ccmsg);
175 if (conn->sending) {
176 isc_socket_cancel(conn->sock, listener->task,
181 ISC_LIST_UNLINK(listener->connections, conn, link);
182 isc_mem_put(listener->mctx, conn, sizeof(*conn));
187 controlconnection_t *conn;
205 for (conn = ISC_LIST_HEAD(listener->connections);
206 conn != NULL;
207 conn = next)
209 next = ISC_LIST_NEXT(conn, link);
210 maybe_free_connection(conn);
272 controlconnection_t *conn = event->ev_arg;
273 controllistener_t *listener = conn->listener;
277 REQUIRE(conn->sending);
281 conn->sending = ISC_FALSE;
298 result = isccc_ccmsg_readmessage(&conn->ccmsg, listener->task,
299 control_recvmessage, conn);
301 isc_socket_detach(&conn->sock);
302 maybe_free_connection(conn);
322 controlconnection_t *conn;
344 conn = event->ev_arg;
345 listener = conn->listener;
352 if (conn->ccmsg.result != ISC_R_SUCCESS) {
353 if (conn->ccmsg.result != ISC_R_CANCELED &&
354 conn->ccmsg.result != ISC_R_EOF)
355 log_invalid(&conn->ccmsg, conn->ccmsg.result);
365 ccregion.rstart = isc_buffer_base(&conn->ccmsg.buffer);
366 ccregion.rend = isc_buffer_used(&conn->ccmsg.buffer);
377 log_invalid(&conn->ccmsg, result);
383 log_invalid(&conn->ccmsg, ISCCC_R_BADAUTH);
389 log_invalid(&conn->ccmsg, ISC_R_FAILURE);
400 log_invalid(&conn->ccmsg, ISC_R_FAILURE);
406 log_invalid(&conn->ccmsg, ISCCC_R_CLOCKSKEW);
410 log_invalid(&conn->ccmsg, ISC_R_FAILURE);
419 log_invalid(&conn->ccmsg, ISCCC_R_EXPIRED);
431 log_invalid(&conn->ccmsg, result);
435 if (conn->nonce != 0 &&
437 conn->nonce != nonce)) {
438 log_invalid(&conn->ccmsg, ISCCC_R_BADAUTH);
445 while (conn->nonce == 0)
446 isc_random_get(&conn->nonce);
478 isccc_cc_defineuint32(_ctrl, "_nonce", conn->nonce) == NULL)
481 ccregion.rstart = conn->buffer + 4;
482 ccregion.rend = conn->buffer + sizeof(conn->buffer);
486 isc_buffer_init(&b, conn->buffer, 4);
487 len = sizeof(conn->buffer) - REGION_SIZE(ccregion);
489 r.base = conn->buffer;
492 result = isc_socket_send(conn->sock, &r, task, control_senddone, conn);
495 conn->sending = ISC_TRUE;
510 isc_socket_detach(&conn->sock);
511 isccc_ccmsg_invalidate(&conn->ccmsg);
512 conn->ccmsg_valid = ISC_FALSE;
513 maybe_free_connection(conn);
519 controlconnection_t *conn = event->ev_arg;
523 isc_timer_detach(&conn->timer);
524 maybe_free_connection(conn);
531 controlconnection_t *conn;
535 conn = isc_mem_get(listener->mctx, sizeof(*conn));
536 if (conn == NULL)
539 conn->sock = sock;
540 isccc_ccmsg_init(listener->mctx, sock, &conn->ccmsg);
541 conn->ccmsg_valid = ISC_TRUE;
542 conn->sending = ISC_FALSE;
543 conn->timer = NULL;
547 control_timeout, conn, &conn->timer);
551 conn->listener = listener;
552 conn->nonce = 0;
553 ISC_LINK_INIT(conn, link);
555 result = isccc_ccmsg_readmessage(&conn->ccmsg, listener->task,
556 control_recvmessage, conn);
559 isccc_ccmsg_setmaxsize(&conn->ccmsg, 2048);
561 ISC_LIST_APPEND(listener->connections, conn, link);
565 isccc_ccmsg_invalidate(&conn->ccmsg);
566 if (conn->timer != NULL)
567 isc_timer_detach(&conn->timer);
568 isc_mem_put(listener->mctx, conn, sizeof(*conn));