Exemplo n.º 1
0
func (l *Peer) ReceiveMessage(c net.Conn) net.MessageSigning {
	app, err := c.Receive()
	if err != nil {
		dbg.Fatal(l.String(), "could not receive message from", c.PeerName())

	}
	if app.MsgType != net.MessageSigningType {
		dbg.Fatal(l.String(), "MS error: received", app.MsgType.String(), "from", c.PeerName())
	}
	return app.Msg.(net.MessageSigning)
}
Exemplo n.º 2
0
func (l *Peer) ReceiveListBasicSignature(c net.Conn) net.ListBasicSignature {
	app, err := c.Receive()
	if err != nil {
		dbg.Fatal(l.String(), "could not receive listbasicsig from", c.PeerName())
	}

	if app.MsgType != net.ListBasicSignatureType {
		dbg.Fatal(l.String(), "LBS error: received", app.MsgType.String(), "from", c.PeerName())
	}
	return app.Msg.(net.ListBasicSignature)

}
Exemplo n.º 3
0
// Wait for the leader to receive the generated signatures from the servers
func (l *Peer) ReceiveBasicSignature(c net.Conn) *net.BasicSignature {

	appMsg, err := c.Receive()
	if err != nil {
		dbg.Fatal(l.String(), "error decoding message from", c.PeerName())
	}
	if appMsg.MsgType != net.BasicSignatureType {
		dbg.Fatal(l.String(), "Received an unknown type:", appMsg.MsgType.String())
	}
	bs := appMsg.Msg.(net.BasicSignature)
	return &bs
}