Revision f1bad954 transaction.h

View differences:

transaction.h
8 8
#ifndef TRANSACTION_H
9 9
#define TRANSACTION_H
10 10

  
11
#include <stdbool.h>
12

  
13 11
/* timeout of the offers thread. If it is not updated, it is deleted */
14
#define TRANS_ID_MAX_LIFETIME 1.0
12
#define TRANS_ID_MAX_LIFETIME 1.5
13

  
14
// struct nodeID;
15

  
16
typedef struct {
17
	uint16_t trans_id;
18
	double offer_sent_time;
19
	double accept_received_time;
20
	struct nodeID *id;
21
	} service_time;
15 22

  
16
struct nodeID;
23

  
24
// List to trace peer's service times
25
struct service_times_element {
26
	service_time st;
27
	struct service_times_element *backward;
28
	struct service_times_element *forward;
29
	};
17 30

  
18 31
// register the moment when a transaction is started
19 32
// return a  new transaction id
20 33
uint16_t transaction_create(struct nodeID *id);
21 34

  
22
// Add the moment I received a positive select in a list
23
// return true if a valid trans_id is found
24
bool transaction_reg_accept(uint16_t trans_id, struct nodeID *id);
35
// Change transaction status when an accept has been received
36
bool transaction_change(uint16_t trans_id, struct nodeID *id);
25 37

  
26 38
// Used to get the time elapsed from the moment I get a positive select to the moment i get the ACK
27 39
// related to the same chunk
28 40
// it return -1.0 in case no trans_id is found
29 41
double transaction_remove(uint16_t trans_id);
30 42

  
43
// Check neighbor list to prune elapsed pending threads
44
void transactions_check();
45

  
31 46
#endif // TRANSACTION_H

Also available in: Unified diff