net_transport.go
func (n *NetworkTransport) genericRPC(id ServerID, target ServerAddress, rpcType uint8, args interface{}, resp interface{}) error {
	// Get a conn
	conn, err := n.getConnFromAddressProvider(id, target)
	if err != nil {
		return err
	}

	// Set a deadline
	if n.timeout > 0 {
		conn.conn.SetDeadline(time.Now().Add(n.timeout))
	}

	// Send the RPC
	if err = sendRPC(conn, rpcType, args); err != nil {
		return err
	}

	// Decode the response
	canReturn, err := decodeResponse(conn, resp)
	if canReturn {
		n.returnConn(conn)
	}
	return err
}
func (n *NetworkTransport) genericRPC(id ServerID, target ServerAddress, rpcType uint8, args interface{}, resp interface{}) error {
	// Get a conn
	conn, err := n.getConnFromAddressProvider(id, target)
	if err != nil {
		return err
	}

	// Set a deadline
	if n.timeout > 0 {
		conn.conn.SetDeadline(time.Now().Add(n.timeout))
	}

	// Send the RPC
	if err = sendRPC(conn, rpcType, args); err != nil {
		return err
	}

	// Decode the response
	canReturn, err := decodeResponse(conn, resp)
	if canReturn {
		n.returnConn(conn)
	}
	return err
}
func ( n * NetworkTransport ) genericRPC ( id ServerID , target ServerAddress , rpcType uint8 , args interface { } , resp interface { } ) error { // Get a conn conn , err := n . getConnFromAddressProvider ( id , target ) if err != nil { return err } // Set a deadline if n . timeout > 0 { conn . conn . SetDeadline ( time . Now ( ) . Add ( n . timeout ) ) } // Send the RPC if err = sendRPC ( conn , rpcType , args ) ; err != nil { return err } // Decode the response canReturn , err := decodeResponse ( conn , resp ) if canReturn { n . returnConn ( conn ) } return err }
// genericRPC handles a simple request/response RPC.
genericRPC handles a simple request / response RPC .