Remove code duplication when checking ADD_EDGE/DEL_EDGE messages.
This commit is contained in:
parent
5cddf5e52a
commit
2762509be1
1 changed files with 2 additions and 14 deletions
|
@ -70,13 +70,7 @@ bool add_edge_h(connection_t *c) {
|
||||||
|
|
||||||
/* Check if names are valid */
|
/* Check if names are valid */
|
||||||
|
|
||||||
if(!check_id(from_name)) {
|
if(!check_id(from_name) || !check_id(to_name)) {
|
||||||
logger(LOG_ERR, "Got bad %s from %s (%s): %s", "ADD_EDGE", c->name,
|
|
||||||
c->hostname, "invalid name");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!check_id(to_name)) {
|
|
||||||
logger(LOG_ERR, "Got bad %s from %s (%s): %s", "ADD_EDGE", c->name,
|
logger(LOG_ERR, "Got bad %s from %s (%s): %s", "ADD_EDGE", c->name,
|
||||||
c->hostname, "invalid name");
|
c->hostname, "invalid name");
|
||||||
return false;
|
return false;
|
||||||
|
@ -186,13 +180,7 @@ bool del_edge_h(connection_t *c) {
|
||||||
|
|
||||||
/* Check if names are valid */
|
/* Check if names are valid */
|
||||||
|
|
||||||
if(!check_id(from_name)) {
|
if(!check_id(from_name) || !check_id(to_name)) {
|
||||||
logger(LOG_ERR, "Got bad %s from %s (%s): %s", "DEL_EDGE", c->name,
|
|
||||||
c->hostname, "invalid name");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!check_id(to_name)) {
|
|
||||||
logger(LOG_ERR, "Got bad %s from %s (%s): %s", "DEL_EDGE", c->name,
|
logger(LOG_ERR, "Got bad %s from %s (%s): %s", "DEL_EDGE", c->name,
|
||||||
c->hostname, "invalid name");
|
c->hostname, "invalid name");
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue