-/*
-Checks if a tranascation with similar type has been ongoing. If not then creates one.
-Returns error if there is similar transatcion ongoing.
-*/
-func (t *Tracker) TrackTransaction(subID uint16, act Action, addr string, port uint16, params *xapp.RMRParams, respReceived bool, forwardRespToXapp bool) (*Transaction, error) {
- key := TransactionKey{subID, act}
- xappkey := TransactionXappKey{addr, port, params.Xid}
- trans := &Transaction{t, key, xappkey, params, respReceived, forwardRespToXapp}
- t.mutex.Lock()
- defer t.mutex.Unlock()
- if _, ok := t.transactionTable[key]; ok {
- // TODO: Implement merge related check here. If the key is same but the value is different.
- err := fmt.Errorf("transaction tracker: Similar transaction with sub id %d and type %s is ongoing", key.SubID, key.TransType)
- return nil, err
- }
- if _, ok := t.transactionXappTable[xappkey]; ok {
- // TODO: Implement merge related check here. If the key is same but the value is different.
- err := fmt.Errorf("transaction tracker: Similar transaction with xapp key %v is ongoing", xappkey)
+func (t *Tracker) TrackTransaction(
+ endpoint *RmrEndpoint,
+ xid string,
+ meid *xapp.RMRMeid,
+ respReceived bool,
+ forwardRespToXapp bool) (*Transaction, error) {
+
+ if endpoint == nil {
+ err := fmt.Errorf("Tracker: No valid endpoint given")