::encode(peer_stat, payload);
::encode(stamp, payload);
- bufferlist pad;
- size_t s = MAX(min_message_size - payload.length(), 0);
- // this should be big enough for normal min_message padding sizes. since
- // we are targetting jumbo ethernet frames around 9000 bytes, 16k should
- // be more than sufficient! the compiler will statically zero this so
- // that at runtime we are only adding a bufferptr reference to it.
- static char zeros[16384] = {};
- while (s > sizeof(zeros)) {
- pad.append(buffer::create_static(sizeof(zeros), zeros));
- s -= sizeof(zeros);
- }
+ size_t s = 0;
+ if (min_message_size > payload.length())
+ s = min_message_size - payload.length();
+ ::encode((uint32_t)s, payload);
if (s) {
- pad.append(buffer::create_static(s, zeros));
+ bufferlist pad;
+ // this should be big enough for normal min_message padding sizes. since
+ // we are targetting jumbo ethernet frames around 9000 bytes, 16k should
+ // be more than sufficient! the compiler will statically zero this so
+ // that at runtime we are only adding a bufferptr reference to it.
+ static char zeros[16384] = {};
+ while (s > sizeof(zeros)) {
+ pad.append(buffer::create_static(sizeof(zeros), zeros));
+ s -= sizeof(zeros);
+ }
+ if (s) {
+ pad.append(buffer::create_static(s, zeros));
+ }
+ ::encode(pad, payload);
}
- ::encode(pad, payload);
}
const char *get_type_name() const { return "osd_ping"; }