代码拉取完成,页面将自动刷新
package transaction
import (
"fmt"
"sync"
"github.com/discoviking/fsm"
"gitee.com/zhjun2512/gosip/log"
"gitee.com/zhjun2512/gosip/sip"
)
type TxKey = sip.TransactionKey
// Tx is an common SIP transaction
type Tx interface {
Init() error
Key() TxKey
Origin() sip.Request
// Receive receives message from transport layer.
Receive(msg sip.Message) error
String() string
Transport() sip.Transport
Terminate()
Errors() <-chan error
Done() <-chan bool
}
type commonTx struct {
key TxKey
fsm *fsm.FSM
fsmMu sync.RWMutex
origin sip.Request
tpl sip.Transport
lastResp sip.Response
errs chan error
lastErr error
done chan bool
log log.Logger
}
func (tx *commonTx) String() string {
if tx == nil {
return "<nil>"
}
fields := tx.Log().Fields().WithFields(log.Fields{
"key": tx.key,
})
return fmt.Sprintf("%s<%s>", tx.Log().Prefix(), fields)
}
func (tx *commonTx) Log() log.Logger {
return tx.log
}
func (tx *commonTx) Origin() sip.Request {
return tx.origin
}
func (tx *commonTx) Key() TxKey {
return tx.key
}
func (tx *commonTx) Transport() sip.Transport {
return tx.tpl
}
func (tx *commonTx) Errors() <-chan error {
return tx.errs
}
func (tx *commonTx) Done() <-chan bool {
return tx.done
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。