Lines Matching defs:manager

227 	isc_socketmgr_t	       *manager;
324 /* Locked by manager lock. */
433 signal_iocompletionport_exit(isc_socketmgr_t *manager) {
438 REQUIRE(VALID_MANAGER(manager));
439 for (i = 0; i < manager->maxIOCPThreads; i++) {
440 if (!PostQueuedCompletionStatus(manager->hIoCompletionPort,
457 iocompletionport_createthreads(int total_threads, isc_socketmgr_t *manager) {
463 REQUIRE(VALID_MANAGER(manager));
468 manager->hIOCPThreads[i] = CreateThread(NULL, 0, SocketIoThread,
469 manager, 0,
470 &manager->dwIOCPThreadIds[i]);
471 if (manager->hIOCPThreads[i] == NULL) {
488 iocompletionport_init(isc_socketmgr_t *manager) {
492 REQUIRE(VALID_MANAGER(manager));
510 manager->maxIOCPThreads = min(isc_os_ncpus() + 1, MAX_IOCPTHREADS);
513 manager->hIoCompletionPort = CreateIoCompletionPort(
515 0, manager->maxIOCPThreads);
516 if (manager->hIoCompletionPort == NULL) {
531 iocompletionport_createthreads(manager->maxIOCPThreads, manager);
546 sock->manager->hIoCompletionPort, (ULONG_PTR)sock, 0);
573 InterlockedIncrement(&sock->manager->iocp_total);
593 InterlockedDecrement(&sock->manager->totalSockets);
1064 ev = (isc_socketevent_t *)isc_event_allocate(sock->manager->mctx,
1445 allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type,
1450 sock = isc_mem_get(manager->mctx, sizeof(*sock));
1458 sock->manager = manager;
1485 sock->recvbuf.base = isc_mem_get(manager->mctx, sock->recvbuf.len); // max buffer size
1508 isc_mem_put(manager->mctx, sock->recvbuf.base, sock->recvbuf.len);
1509 isc_mem_put(manager->mctx, sock, sizeof(*sock));
1569 * When calling this function, the socket must be locked, and the manager
1603 isc_socketmgr_t *manager;
1610 manager = sock->manager;
1620 isc_mem_put(manager->mctx, sock->recvbuf.base,
1623 LOCK(&manager->lock);
1625 ISC_LIST_UNLINK(manager->socklist, sock, link);
1626 isc_mem_put(manager->mctx, sock, sizeof(*sock));
1628 if (ISC_LIST_EMPTY(manager->socklist))
1629 SIGNAL(&manager->shutdown_ok);
1630 UNLOCK(&manager->lock);
1634 * Create a new 'type' socket managed by 'manager'. Events
1640 isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
1654 REQUIRE(VALID_MANAGER(manager));
1658 result = allocate_socket(manager, type, &sock);
1793 LOCK(&manager->lock);
1794 ISC_LIST_APPEND(manager->socklist, sock, link);
1795 InterlockedIncrement(&manager->totalSockets);
1796 UNLOCK(&manager->lock);
2039 * Hook it up into the manager.
2045 LOCK(&nsock->manager->lock);
2046 ISC_LIST_APPEND(nsock->manager->socklist, nsock, link);
2047 InterlockedIncrement(&nsock->manager->totalSockets);
2048 UNLOCK(&nsock->manager->lock);
2370 InterlockedDecrement(&nsock->manager->iocp_total);
2383 isc_socketmgr_t *manager = ThreadContext;
2394 REQUIRE(VALID_MANAGER(manager));
2417 bSuccess = GetQueuedCompletionStatus(manager->hIoCompletionPort,
2553 manager_log(manager, TRACE,
2560 * Create a new socket manager.
2571 isc_socketmgr_t *manager;
2579 manager = isc_mem_get(mctx, sizeof(*manager));
2580 if (manager == NULL)
2585 manager->magic = SOCKET_MANAGER_MAGIC;
2586 manager->mctx = NULL;
2587 manager->stats = NULL;
2588 ISC_LIST_INIT(manager->socklist);
2589 result = isc_mutex_init(&manager->lock);
2591 isc_mem_put(mctx, manager, sizeof(*manager));
2594 if (isc_condition_init(&manager->shutdown_ok) != ISC_R_SUCCESS) {
2595 DESTROYLOCK(&manager->lock);
2596 isc_mem_put(mctx, manager, sizeof(*manager));
2604 isc_mem_attach(mctx, &manager->mctx);
2606 iocompletionport_init(manager); /* Create the Completion Ports */
2608 manager->bShutdown = ISC_FALSE;
2609 manager->totalSockets = 0;
2610 manager->iocp_total = 0;
2612 *managerp = manager;
2618 isc_socketmgr_getmaxsockets(isc_socketmgr_t *manager, unsigned int *nsockp) {
2619 REQUIRE(VALID_MANAGER(manager));
2626 isc_socketmgr_setstats(isc_socketmgr_t *manager, isc_stats_t *stats) {
2627 REQUIRE(VALID_MANAGER(manager));
2628 REQUIRE(ISC_LIST_EMPTY(manager->socklist));
2629 REQUIRE(manager->stats == NULL);
2632 isc_stats_attach(stats, &manager->stats);
2637 isc_socketmgr_t *manager;
2642 * Destroy a socket manager.
2646 manager = *managerp;
2647 REQUIRE(VALID_MANAGER(manager));
2649 LOCK(&manager->lock);
2654 while (!ISC_LIST_EMPTY(manager->socklist)) {
2655 manager_log(manager, CREATION,
2659 WAIT(&manager->shutdown_ok, &manager->lock);
2662 UNLOCK(&manager->lock);
2668 signal_iocompletionport_exit(manager);
2669 manager->bShutdown = ISC_TRUE;
2674 for (i = 0; i < manager->maxIOCPThreads; i++) {
2675 if (isc_thread_join((isc_thread_t) manager->hIOCPThreads[i],
2686 CloseHandle(manager->hIoCompletionPort);
2688 (void)isc_condition_destroy(&manager->shutdown_ok);
2690 DESTROYLOCK(&manager->lock);
2691 if (manager->stats != NULL)
2692 isc_stats_detach(&manager->stats);
2693 manager->magic = 0;
2694 mctx= manager->mctx;
2695 isc_mem_put(mctx, manager, sizeof(*manager));
2766 isc_socketmgr_t *manager;
2788 manager = sock->manager;
2789 REQUIRE(VALID_MANAGER(manager));
2835 isc_socketmgr_t *manager;
2851 manager = sock->manager;
2852 REQUIRE(VALID_MANAGER(manager));
2994 isc_socketmgr_t *manager;
3014 manager = sock->manager;
3015 REQUIRE(VALID_MANAGER(manager));
3055 isc_socketmgr_t *manager;
3077 manager = sock->manager;
3078 REQUIRE(VALID_MANAGER(manager));
3274 isc_socketmgr_t *manager;
3282 manager = sock->manager;
3283 REQUIRE(VALID_MANAGER(manager));
3304 isc_event_allocate(manager->mctx, task, ISC_SOCKEVENT_NEWCONN,
3312 result = allocate_socket(manager, sock->type, &nsock);
3394 isc_socketmgr_t *manager;
3403 manager = sock->manager;
3404 REQUIRE(VALID_MANAGER(manager));
3453 cdev = (isc_socket_connev_t *)isc_event_allocate(manager->mctx, sock,
3811 isc__socketmgr_setreserved(isc_socketmgr_t *manager, isc_uint32_t reserved) {
3812 UNUSED(manager);