mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 08:46:58 +08:00
Added failure codes for proc_table_add()
This commit is contained in:
@@ -275,7 +275,10 @@ struct proc_st *old_proc;
|
||||
memcpy(proc->ipv4_seed, &cmsg->ipv4_seed, sizeof(proc->ipv4_seed));
|
||||
|
||||
/* add the links to proc hash */
|
||||
proc_table_add(s, proc);
|
||||
if (proc_table_add(s, proc) < 0) {
|
||||
mslog(s, proc, LOG_ERR, "failed to add proc hashes");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -83,29 +83,29 @@ void proc_table_deinit(main_server_st *s)
|
||||
talloc_free(s->proc_table.db_sid);
|
||||
}
|
||||
|
||||
void proc_table_add(main_server_st *s, struct proc_st *proc)
|
||||
int proc_table_add(main_server_st *s, struct proc_st *proc)
|
||||
{
|
||||
size_t ip_hash = rehash_ip(proc, NULL);
|
||||
size_t dtls_id_hash = rehash_dtls_id(proc, NULL);
|
||||
|
||||
if (htable_add(s->proc_table.db_ip, ip_hash, proc) == 0) {
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (htable_add(s->proc_table.db_dtls_id, dtls_id_hash, proc) == 0) {
|
||||
htable_del(s->proc_table.db_ip, ip_hash, proc);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (htable_add(s->proc_table.db_sid, rehash_sid(proc, NULL), proc) == 0) {
|
||||
htable_del(s->proc_table.db_ip, ip_hash, proc);
|
||||
htable_del(s->proc_table.db_dtls_id, dtls_id_hash, proc);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
s->proc_table.total++;
|
||||
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void proc_table_del(main_server_st *s, struct proc_st *proc)
|
||||
|
||||
@@ -36,7 +36,7 @@ struct proc_st *proc_search_sid(struct main_server_st *s,
|
||||
|
||||
void proc_table_init(main_server_st *s);
|
||||
void proc_table_deinit(main_server_st *s);
|
||||
void proc_table_add(main_server_st *s, struct proc_st *proc);
|
||||
int proc_table_add(main_server_st *s, struct proc_st *proc);
|
||||
void proc_table_del(main_server_st *s, struct proc_st *proc);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user