Skip to content

Commit d6b28af

Browse files
microlb: wrong ordering between flush and session create caused out of order data
1 parent 4debeac commit d6b28af

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

lib/microLB/micro_lb/balancer.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,14 @@ namespace microLB
202202
assert(outgoing->is_connected());
203203
LBOUT("Assigning client to node %d (%s)\n",
204204
algo_iterator, outgoing->to_string().c_str());
205-
auto& session = this->create_session(
206-
std::move(conn), std::move(outgoing));
207-
// flush readq to session.outgoing
205+
// flush readq to outgoing before creating session
208206
for (auto buffer : readq) {
209207
LBOUT("*** Flushing %lu bytes\n", buffer->size());
210-
session.outgoing->write(buffer);
208+
outgoing->write(buffer);
211209
}
210+
auto& session = this->create_session(
211+
std::move(conn), std::move(outgoing));
212+
212213
return nullptr;
213214
}
214215
}

0 commit comments

Comments
 (0)