func (p *Peer) ReadFrom(b []byte) (n int, remote net.Addr, err error) {
	c := make(chan struct{})
	p.actions <- func() {
		go func() { // so as not to block loop
			defer close(c)
			select {
			case pkt := <-p.recv:
				n = copy(b, pkt.Buf)
				remote = MeshAddr{PeerName: pkt.SrcName, PeerUID: pkt.SrcUID}
				if n < len(pkt.Buf) {
					err = ErrShortRead
				}
			case <-p.quit:
				err = ErrPeerClosed
			}
		}()
	}
	<-c
	return n, remote, err
}
func (p *Peer) ReadFrom(b []byte) (n int, remote net.Addr, err error) {
	c := make(chan struct{})
	p.actions <- func() {
		go func() { // so as not to block loop
			defer close(c)
			select {
			case pkt := <-p.recv:
				n = copy(b, pkt.Buf)
				remote = MeshAddr{PeerName: pkt.SrcName, PeerUID: pkt.SrcUID}
				if n < len(pkt.Buf) {
					err = ErrShortRead
				}
			case <-p.quit:
				err = ErrPeerClosed
			}
		}()
	}
	<-c
	return n, remote, err
}
func ( p * Peer ) ReadFrom ( b [ ] byte ) ( n int , remote net . Addr , err error ) { c := make ( chan struct { } ) p . actions <- func ( ) { go func ( ) { // so as not to block loop defer close ( c ) select { case pkt := <- p . recv : n = copy ( b , pkt . Buf ) remote = MeshAddr { PeerName : pkt . SrcName , PeerUID : pkt . SrcUID } if n < len ( pkt . Buf ) { err = ErrShortRead } case <- p . quit : err = ErrPeerClosed } } ( ) } <- c return n , remote , err }
// ReadFrom implements net.PacketConn.
// Clients should consume from ReadFrom without blocking.
ReadFrom implements net . PacketConn . Clients should consume from ReadFrom without blocking .