当前位置: 首页>>代码示例>>Golang>>正文


Golang Frame.Bind方法代码示例

本文整理汇总了Golang中github.com/petar/GoTeleport/tele/trace.Frame.Bind方法的典型用法代码示例。如果您正苦于以下问题:Golang Frame.Bind方法的具体用法?Golang Frame.Bind怎么用?Golang Frame.Bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/petar/GoTeleport/tele/trace.Frame的用法示例。


在下文中一共展示了Frame.Bind方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: NewTransport

func NewTransport(frame trace.Frame, sub *codec.Transport) *Transport {
	t := &Transport{
		frame:  frame,
		sub:    sub,
		Dialer: NewDialer(frame.Refine("dialer"), sub),
	}
	frame.Bind(t)
	return t
}
开发者ID:WIZARD-CXY,项目名称:golang-devops-stuff,代码行数:9,代码来源:transport.go

示例2: NewListener

func NewListener(frame trace.Frame, sub *codec.Listener) *Listener {
	l := &Listener{frame: frame, sub: sub, ach: make(chan *Conn)}
	frame.Bind(l)
	go func() {
		for {
			NewAcceptBridge(l.frame.Refine("accept"), l, l.sub.Accept())
		}
	}()
	return l
}
开发者ID:WIZARD-CXY,项目名称:golang-devops-stuff,代码行数:10,代码来源:listener.go

示例3: NewBuffer

// NewBuffer creates a new buffer with limit m.
func NewBuffer(frame trace.Frame, m int) *Buffer {
	b := &Buffer{
		wch: make(chan struct{}, m+1), // +1 for the final EOF, so it does not block
		// The capacity of rch is chosen so that writers to rch will never block.
		rch: make(chan struct{}, 4*m+2),
	}
	frame.Bind(b)
	b.Frame = frame
	for i := 0; i < m; i++ {
		b.wch <- struct{}{}
	}
	return b
}
开发者ID:WIZARD-CXY,项目名称:golang-devops-stuff,代码行数:14,代码来源:buffer.go

示例4: Start

func (a *Conn) Start(frame trace.Frame, id chainID, addr net.Addr, linker linker, scrb func()) {
	frame.Bind(a)
	a.frame = frame
	a.scrb = scrb
	a.id = id
	a.addr = addr
	a.linker = linker
	a.cascade = MakeCascade(frame)
	// A buffer size 1 on rch, helps remove a deadlock in the TestConn.
	// Essentially it ensures that Read and Write (on two ends of a
	// connection) cannot deadlock each other when a successful Write also
	// requires a stitch. We throw in a couple of extra buffer spaces to
	// prevent any potential deadlock between Read and Kill.
	a.rch = make(chan interface{}, 3)
	a.kch = make(chan struct{})
	go a.readLoop()
}
开发者ID:nkts,项目名称:golang-devops-stuff,代码行数:17,代码来源:conn.go


注:本文中的github.com/petar/GoTeleport/tele/trace.Frame.Bind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。