// Send message by public key of receiver.
// Function supported multiple routing with pseudo sender.
Send message by public key of receiver.
Function supported multiple routing with pseudo sender.
// Send message by public key of receiver . // Function supported multiple routing with pseudo sender .
func (node *Node) Send(msg *local.Message, route *local.Route) ([]byte, error) {
	var (
		err      error
		result   []byte
		hash     = route.Receiver().Address()
		retryNum = gopeer.Get("RETRY_NUM").(uint)
	)
	node.setAction(hash)
	defer node.delAction(hash)
REPEAT:
	routeMsg := node.client.RouteMessage(msg, route)
	if routeMsg == nil {
		return result, errors.New("psender is nil and routes not nil")
	}
	node.send(routeMsg)
	waitTime := time.Duration(gopeer.Get("WAIT_TIME").(uint))
	select {
	case result = <-node.getAction(hash):
	case <-time.After(waitTime * time.Second):
		if retryNum > 1 {
			retryNum -= 1
			goto REPEAT
		}
		err = errors.New("time is over")
	}
	node.delAction(hash)
	return result, err
}
func ( node * Node ) Send ( msg * local . Message , route * local . Route ) ( [ ] byte , error ) { var ( err error result [ ] byte hash = route . Receiver ( ) . Address ( ) retryNum = gopeer . Get ( " " ) . ( uint ) ) node . setAction ( hash ) defer node . delAction ( hash ) REPEAT : routeMsg := node . client . RouteMessage ( msg , route ) if routeMsg == nil { return result , errors . New ( " " ) } node . send ( routeMsg ) waitTime := time . Duration ( gopeer . Get ( " " ) . ( uint ) ) select { case result = <- node . getAction ( hash ) : case <- time . After ( waitTime * time . Second ) : if retryNum > 1 { retryNum -= 1 goto REPEAT } err = errors . New ( " " ) } node . delAction ( hash ) return result , err }
Send message by public key of receiver.
Send message by public key of receiver .