Skip to content

Commit 9d89358

Browse files
Merge branch 'tcp_rcvwnd' of github.com:AndreasAakesson/IncludeOS into tcp_rcvwnd
2 parents 079e8e4 + e1f2fb1 commit 9d89358

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

api/net/tcp/read_buffer.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ class Read_buffer {
8484
buffer_t buffer()
8585
{ return buf; }
8686

87+
/**
88+
* @brief Check if internal buffer has unhandled data
89+
*
90+
* @return True if the internal buffer is unique with data and doesnt contain hole
91+
*/
92+
bool has_unhandled_data()
93+
{ return (buf.unique() && (size() > 0) && (missing() == 0)); }
94+
8795
/**
8896
* @brief Exposes the internal buffer (read only)
8997
*

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
}

src/net/tcp/read_request.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,9 @@ namespace tcp {
202202
// if noone is using the buffer right now, (stupid yes)
203203
// AND it contains data without any holes,
204204
// return it to the user
205-
if(buf->buffer().unique() and buf->size() > 0 and buf->missing() == 0)
205+
if (buf->has_unhandled_data())
206206
{
207+
207208
callback(buf->buffer());
208209
}
209210
// reset the first buffer

0 commit comments

Comments
 (0)