[1/7] alfred: Avoid hash search for transaction cleanup
Commit Message
A transaction can either be cleaned up on timeout or on TXEND. alfred has
in both situations already the head of the transaction list. An extra
search in the transaction hash is therefore not needed.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
alfred.h | 3 ---
recv.c | 16 +---------------
2 files changed, 1 insertion(+), 18 deletions(-)
@@ -159,9 +159,6 @@ int recv_alfred_packet(struct globals *globals, struct interface *interface,
int recv_sock);
struct transaction_head *
transaction_add(struct globals *globals, struct ether_addr mac, uint16_t id);
-struct transaction_head *
-transaction_clean_hash(struct globals *globals,
- struct transaction_head *search);
struct transaction_head *transaction_clean(struct globals *globals,
struct transaction_head *head);
/* send.c */
@@ -160,18 +160,6 @@ struct transaction_head *transaction_clean(struct globals *globals,
return head;
}
-struct transaction_head *
-transaction_clean_hash(struct globals *globals, struct transaction_head *search)
-{
- struct transaction_head *head;
-
- head = hash_find(globals->transaction_hash, search);
- if (!head)
- return head;
-
- return transaction_clean(globals, head);
-}
-
static int process_alfred_push_data(struct globals *globals,
struct in6_addr *source,
struct alfred_push_data_v0 *push)
@@ -369,9 +357,7 @@ static int process_alfred_status_txend(struct globals *globals,
free(transaction_packet);
}
- head = transaction_clean_hash(globals, &search);
- if (!head)
- return -1;
+ transaction_clean(globals, head);
if (head->client_socket < 0)
free(head);