Return error codes for port_hash operations.

This commit is contained in:
Max Romanov
2017-10-04 15:02:00 +03:00
parent 85e485776b
commit f869bf1b02
3 changed files with 30 additions and 8 deletions

View File

@@ -1859,11 +1859,16 @@ nxt_runtime_port_first(nxt_runtime_t *rt, nxt_lvlhsh_each_t *lhe)
void
nxt_runtime_port_add(nxt_task_t *task, nxt_port_t *port)
{
nxt_int_t res;
nxt_runtime_t *rt;
rt = task->thread->runtime;
nxt_port_hash_add(&rt->ports, port);
res = nxt_port_hash_add(&rt->ports, port);
if (res != NXT_OK) {
return;
}
rt->port_by_type[port->type] = port;
@@ -1874,11 +1879,16 @@ nxt_runtime_port_add(nxt_task_t *task, nxt_port_t *port)
void
nxt_runtime_port_remove(nxt_task_t *task, nxt_port_t *port)
{
nxt_int_t res;
nxt_runtime_t *rt;
rt = task->thread->runtime;
nxt_port_hash_remove(&rt->ports, port);
res = nxt_port_hash_remove(&rt->ports, port);
if (res != NXT_OK) {
return;
}
if (rt->port_by_type[port->type] == port) {
rt->port_by_type[port->type] = NULL;