Esempio n. 1
0
func (s *sim) disconnect(e graph.Edge) {
	l := s.links[e]
	l.sender.Close()
	l.receiver.Close()

	l.closed = true
	s.links[e.Reverse()].closed = true

	delete(s.links, e)
	delete(s.links, e.Reverse())
}
Esempio n. 2
0
func (s *sim) link(e graph.Edge) {
	a := s.cs[e.A]
	b := s.cs[e.B]

	aconn := a.Link(b.id)
	bconn := b.Link(a.id)

	alink := &link{aconn, bconn, false}
	blink := &link{bconn, aconn, false}

	s.links[e] = alink
	s.links[e.Reverse()] = blink

	aconn.SetPendingFunc(func() { s.pending = append(s.pending, alink) })
	bconn.SetPendingFunc(func() { s.pending = append(s.pending, blink) })
}