* This function convert MaxBlockSize from byte to * MB with a decimal precision one digit rounded down * E.g. * 1660000 -> 1.6 * 2010000 -> 2.0 * 1000000 -> 1.0 * 230000 -> 0.2 * 50000 -> 0.0 * * NB behavior for EB<1MB not standardized yet still * the function applies the same algo used for * EB greater or equal to 1MB */
| 3240 | * EB greater or equal to 1MB |
| 3241 | */ |
| 3242 | std::string getSubVersionEB(uint64_t MaxBlockSize) { |
| 3243 | // Prepare EB string we are going to add to SubVer: |
| 3244 | // 1) translate from byte to MB and convert to string |
| 3245 | // 2) limit the EB string to the first decimal digit (floored) |
| 3246 | std::stringstream ebMBs; |
| 3247 | ebMBs << (MaxBlockSize / (ONE_MEGABYTE / 10)); |
| 3248 | std::string eb = ebMBs.str(); |
| 3249 | eb.insert(eb.size() - 1, ".", 1); |
| 3250 | if (eb.substr(0, 1) == ".") { |
| 3251 | eb = "0" + eb; |
| 3252 | } |
| 3253 | return eb; |
| 3254 | } |
| 3255 | |
| 3256 | std::string userAgent(const Config &config) { |
| 3257 | // format excessive blocksize value |