diff options
-rw-r--r-- | ctrl/libhicnctrl/src/api.c | 15 | ||||
-rw-r--r-- | hicn-light/src/hicn/core/mapme.c | 8 | ||||
-rw-r--r-- | hicn-light/src/hicn/processor/fib.c | 4 |
3 files changed, 22 insertions, 5 deletions
diff --git a/ctrl/libhicnctrl/src/api.c b/ctrl/libhicnctrl/src/api.c index 9fb923d13..23a314c0c 100644 --- a/ctrl/libhicnctrl/src/api.c +++ b/ctrl/libhicnctrl/src/api.c @@ -767,9 +767,8 @@ hc_sock_callback(hc_sock_t * s, hc_data_t ** pdata) for (;;) { int n = hc_sock_recv(s); - if (n == 0) { + if (n == 0) goto ERR_EOF; - } if (n < 0) { switch(errno) { case ECONNRESET: @@ -868,7 +867,7 @@ hc_execute_command(hc_sock_t * s, hc_msg_t * msg, size_t msg_len, } int seq = hc_sock_get_next_seq(s); - + /* Create state used to process the request */ hc_sock_request_t * request = NULL; request = hc_sock_request_create(seq, data, params->parse); @@ -897,8 +896,11 @@ hc_execute_command(hc_sock_t * s, hc_msg_t * msg, size_t msg_len, * several times before success... shall we alternate between blocking * and non-blocking mode ? */ - if (hc_sock_recv(s) < 0) - continue; //break; + int n = hc_sock_recv(s); + if (n == 0) + goto ERR_EOF; + if (n < 0) + break; int rc = hc_sock_process(s, pdata); switch(rc) { case 0: @@ -916,7 +918,10 @@ hc_execute_command(hc_sock_t * s, hc_msg_t * msg, size_t msg_len, } } +ERR_EOF: ret = data->ret; + if (!data->complete) + return -1; if (!pdata) hc_data_free(data); diff --git a/hicn-light/src/hicn/core/mapme.c b/hicn-light/src/hicn/core/mapme.c index 79c8a0771..af332ede2 100644 --- a/hicn-light/src/hicn/core/mapme.c +++ b/hicn-light/src/hicn/core/mapme.c @@ -338,6 +338,10 @@ static bool mapme_setFacePending(const MapMe *mapme, const Name *name, Dispatcher *dispatcher = forwarder_GetDispatcher(mapme->forwarder); PARCEventTimer *timer; + /* Safeguard during retransmissions */ + if (!TFIB(fibEntry)) + return true; + /* * On the producer side, we have to clear the TFIB everytime we change the list * of adjacencies, otherwise retransmissions will occur to preserve them. @@ -650,6 +654,9 @@ static bool mapme_onSpecialInterest(const MapMe *mapme, FibEntry *fibEntry = fib_Contains(fib, name); if (!fibEntry) { + INFO(mapme, "Ignored update with no FIB entry"); + return 0; +#if 0 INFO(mapme, "[MAP-Me] - Re-creating FIB entry with next hop on connection %d", conn_in_id); @@ -688,6 +695,7 @@ static bool mapme_onSpecialInterest(const MapMe *mapme, for (size_t i = 0; i < numberSet_Length(lpm_nexthops); i++) { fibEntry_AddNexthop(fibEntry, numberSet_GetItem(lpm_nexthops, i)); } +#endif } else if (!TFIB(fibEntry)) { /* Create TFIB associated to FIB entry */ diff --git a/hicn-light/src/hicn/processor/fib.c b/hicn-light/src/hicn/processor/fib.c index 6bb29c404..c67bc6773 100644 --- a/hicn-light/src/hicn/processor/fib.c +++ b/hicn-light/src/hicn/processor/fib.c @@ -424,8 +424,10 @@ void fib_Remove(FIB *fib, const Name *name, unsigned connId) { } fibEntry_RemoveNexthopByConnectionId(entry, connId); +#ifndef WITH_MAPME if (fibEntry_NexthopCount(entry) == 0) _removeNode(fib, name); +#endif /* WITH_MAPME */ } @@ -434,9 +436,11 @@ void _removeConnectionId(FibNode *n, unsigned connectionId, if(n != NULL){ if(n->is_used){ fibEntry_RemoveNexthopByConnectionId(n->entry, connectionId); +#ifndef WITH_MAPME if (fibEntry_NexthopCount(n->entry) == 0) { fibEntryList_Append(list, n->entry); } +#endif /* WITH_MAPME */ } _removeConnectionId(n->right, connectionId, list); _removeConnectionId(n->left, connectionId, list); |