Fix alignment of recieved packet

GitOrigin-RevId: 8cbb24dabb7cf8050cecd47364df496b122db559
This commit is contained in:
Arseny Smirnov 2018-06-15 17:30:32 +03:00
parent 4aa5b0af02
commit b44c7cfcb8

View File

@ -64,6 +64,12 @@ Status RawConnection::flush_read(const AuthKey &auth_key, Callback &callback) {
BufferSlice packet;
uint32 quick_ack = 0;
TRY_RESULT(wait_size, transport_->read_next(&packet, &quick_ack));
if (!is_aligned_pointer<4>(packet.as_slice().ubegin())) {
BufferSlice new_packet(packet.size());
new_packet.as_slice().copy_from(packet.as_slice());
packet = std::move(new_packet);
}
CHECK(is_aligned_pointer<4>(packet.as_slice().ubegin()));
if (wait_size != 0) {
break;
}