本文整理匯總了Golang中zombiezen/com/go/capnproto2/std/capnp/rpc.Message.IsValid方法的典型用法代碼示例。如果您正苦於以下問題:Golang Message.IsValid方法的具體用法?Golang Message.IsValid怎麽用?Golang Message.IsValid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類zombiezen/com/go/capnproto2/std/capnp/rpc.Message
的用法示例。
在下文中一共展示了Message.IsValid方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: teardown
// teardown moves the connection from the dying to the dead state.
func (c *Conn) teardown(abort rpccapnp.Message) {
c.workers.Wait()
c.mu.Lock()
for _, q := range c.questions {
if q != nil {
q.cancel(ErrConnClosed)
}
}
c.questions = nil
exps := c.exports
c.exports = nil
c.embargoes = nil
for _, a := range c.answers {
a.cancel()
}
c.answers = nil
c.imports = nil
c.mainFunc = nil
c.mu.Unlock()
if c.mainCloser != nil {
if err := c.mainCloser.Close(); err != nil {
c.errorf("closing main interface: %v", err)
}
c.mainCloser = nil
}
// Closing an export may try to lock the Conn, so run it outside
// critical section.
for id, e := range exps {
if e == nil {
continue
}
if err := e.client.Close(); err != nil {
c.errorf("export %v close: %v", id, err)
}
}
exps = nil
var werr error
if abort.IsValid() {
werr = c.transport.SendMessage(context.Background(), abort)
}
cerr := c.transport.Close()
c.stateMu.Lock()
if c.closeErr == ErrConnClosed {
if cerr != nil {
c.closeErr = cerr
} else if werr != nil {
c.closeErr = werr
}
}
c.state = connDead
c.stateCond.Broadcast()
c.stateMu.Unlock()
}