nxt_process.c (1306:3604d05e48be) nxt_process.c (1446:ad6265786871)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8#include <nxt_main_process.h>

--- 577 unchanged lines hidden (view full) ---

586
587 nxt_runtime_port_remove(task, port);
588
589 } nxt_process_port_loop;
590}
591
592
593void
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8#include <nxt_main_process.h>

--- 577 unchanged lines hidden (view full) ---

586
587 nxt_runtime_port_remove(task, port);
588
589 } nxt_process_port_loop;
590}
591
592
593void
594nxt_process_connected_port_add(nxt_process_t *process, nxt_port_t *port)
595{
596 nxt_thread_mutex_lock(&process->cp_mutex);
597
598 nxt_port_hash_add(&process->connected_ports, port);
599
600 nxt_thread_mutex_unlock(&process->cp_mutex);
601}
602
603
604void
605nxt_process_connected_port_remove(nxt_process_t *process, nxt_port_t *port)
606{
607 nxt_thread_mutex_lock(&process->cp_mutex);
608
609 nxt_port_hash_remove(&process->connected_ports, port);
610
611 nxt_thread_mutex_unlock(&process->cp_mutex);
612}
613
614
615nxt_port_t *
594nxt_process_connected_port_remove(nxt_process_t *process, nxt_port_t *port)
595{
596 nxt_thread_mutex_lock(&process->cp_mutex);
597
598 nxt_port_hash_remove(&process->connected_ports, port);
599
600 nxt_thread_mutex_unlock(&process->cp_mutex);
601}
602
603
604nxt_port_t *
616nxt_process_connected_port_find(nxt_process_t *process, nxt_pid_t pid,
617 nxt_port_id_t port_id)
605nxt_process_connected_port_find_add(nxt_process_t *process, nxt_port_t *port)
618{
619 nxt_port_t *res;
620
621 nxt_thread_mutex_lock(&process->cp_mutex);
622
606{
607 nxt_port_t *res;
608
609 nxt_thread_mutex_lock(&process->cp_mutex);
610
623 res = nxt_port_hash_find(&process->connected_ports, pid, port_id);
611 res = nxt_port_hash_find(&process->connected_ports, port->pid, port->id);
624
612
613 if (nxt_slow_path(res == NULL)) {
614 nxt_port_hash_add(&process->connected_ports, port);
615 }
616
625 nxt_thread_mutex_unlock(&process->cp_mutex);
626
627 return res;
628}
617 nxt_thread_mutex_unlock(&process->cp_mutex);
618
619 return res;
620}