-//-----------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------
-type Transaction struct {
- mutex sync.Mutex
- tracker *Tracker //tracker instance
- Subs *Subscription //related subscription
- RmrEndpoint RmrEndpoint //xapp endpoint
- Mtype int //type of initiating message
- Xid string //xapp xid in req
- Meid *xapp.RMRMeid //meid transaction related
- SubReqMsg *e2ap.E2APSubscriptionRequest //SubReq TODO: maybe own transactions per type
- SubRespMsg *e2ap.E2APSubscriptionResponse //SubResp TODO: maybe own transactions per type
- SubFailMsg *e2ap.E2APSubscriptionFailure //SubFail TODO: maybe own transactions per type
- SubDelReqMsg *e2ap.E2APSubscriptionDeleteRequest //SubDelReq TODO: maybe own transactions per type
- Payload []byte //packed message to optimize retransmissions
- PayloadLen int //packed message len to optimize retransmissions
- RespReceived bool
- ForwardRespToXapp bool
-}
-
-func (t *Transaction) String() string {
- t.mutex.Lock()
- defer t.mutex.Unlock()
- var subId string = "?"
- if t.Subs != nil {
- subId = strconv.FormatUint(uint64(t.Subs.Seq), 10)
+func (t *TransactionBase) SendEvent(event interface{}, waittime time.Duration) (bool, bool) {
+ if waittime > 0 {
+ select {
+ case t.EventChan <- event:
+ return true, false
+ case <-time.After(waittime):
+ return false, true
+ }
+ return false, false