Add endpoint check

This commit is contained in:
c9s 2014-05-19 10:49:47 +08:00
parent 1be560f69c
commit 8ba1230610
2 changed files with 8 additions and 1 deletions

View file

@ -453,7 +453,13 @@ node * _r3_tree_insert_pathl(node *tree, char *path, int path_len, route * route
if ( subpath_len > 0 ) {
return _r3_tree_insert_pathl(e->child, subpath, subpath_len, route, data);
} else {
// no more path to insert
// there are no more path to insert
// see if there is an endpoint already
if (e->child->endpoint) {
// XXX: return an error code instead of NULL
return NULL;
}
e->child->endpoint++; // make it as an endpoint
e->child->data = data;
if (route) {

View file

@ -328,3 +328,4 @@
1400466833,13166545.46
1400466875,13515485.94
1400467139,13047096.38
1400467481,13594764.91

1 1400242718 5649455.80
328 1400466833 13166545.46
329 1400466875 13515485.94
330 1400467139 13047096.38
331 1400467481 13594764.91