Updating -Buffer range support to randomly select a buffer size per IO, not just per connection
This commit is contained in:
Родитель
de063aea3e
Коммит
2261a0f152
|
@ -186,7 +186,6 @@ namespace ctsTraffic {
|
||||||
recv_buffer_container(),
|
recv_buffer_container(),
|
||||||
callback(nullptr),
|
callback(nullptr),
|
||||||
pattern_state(),
|
pattern_state(),
|
||||||
buffer_size(ctsConfig::GetBufferSize()),
|
|
||||||
send_pattern_offset(0),
|
send_pattern_offset(0),
|
||||||
recv_pattern_offset(0),
|
recv_pattern_offset(0),
|
||||||
recv_rio_bufferid(RIO_INVALID_BUFFERID),
|
recv_rio_bufferid(RIO_INVALID_BUFFERID),
|
||||||
|
@ -225,10 +224,10 @@ namespace ctsTraffic {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (_recv_count > 0) {
|
if (_recv_count > 0) {
|
||||||
recv_buffer_container.resize(buffer_size * _recv_count);
|
recv_buffer_container.resize(ctsConfig::GetMaxBufferSize() * _recv_count);
|
||||||
char* raw_recv_buffer = &recv_buffer_container[0];
|
char* raw_recv_buffer = &recv_buffer_container[0];
|
||||||
for (unsigned long free_list = 0; free_list < _recv_count; ++free_list) {
|
for (unsigned long free_list = 0; free_list < _recv_count; ++free_list) {
|
||||||
recv_buffer_free_list.push_back(raw_recv_buffer + static_cast<size_t>(free_list * buffer_size));
|
recv_buffer_free_list.push_back(raw_recv_buffer + static_cast<size_t>(free_list * ctsConfig::GetMaxBufferSize()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// just use the shared buffer to capture the FIN since recv_count == 0
|
// just use the shared buffer to capture the FIN since recv_count == 0
|
||||||
|
@ -240,7 +239,7 @@ namespace ctsTraffic {
|
||||||
if (ctsConfig::Settings->SocketFlags & WSA_FLAG_REGISTERED_IO &&
|
if (ctsConfig::Settings->SocketFlags & WSA_FLAG_REGISTERED_IO &&
|
||||||
recv_rio_bufferid != s_SharedBufferId) {
|
recv_rio_bufferid != s_SharedBufferId) {
|
||||||
ctFatalCondition(_recv_count > 1, L"Current not supporting >1 concurrent IO requests with RIO");
|
ctFatalCondition(_recv_count > 1, L"Current not supporting >1 concurrent IO requests with RIO");
|
||||||
recv_rio_bufferid = ctRIORegisterBuffer(recv_buffer_free_list[0], static_cast<DWORD>(buffer_size));
|
recv_rio_bufferid = ctRIORegisterBuffer(recv_buffer_free_list[0], static_cast<DWORD>(ctsConfig::GetMaxBufferSize()));
|
||||||
if (RIO_INVALID_BUFFERID == recv_rio_bufferid) {
|
if (RIO_INVALID_BUFFERID == recv_rio_bufferid) {
|
||||||
throw ctException(::WSAGetLastError(), L"RIORegisterBuffer", L"ctsIOPattern", false);
|
throw ctException(::WSAGetLastError(), L"RIORegisterBuffer", L"ctsIOPattern", false);
|
||||||
}
|
}
|
||||||
|
@ -558,7 +557,7 @@ namespace ctsTraffic {
|
||||||
// first: calculate the next buffer size assuming no max ceiling specified by the protocol
|
// first: calculate the next buffer size assuming no max ceiling specified by the protocol
|
||||||
//
|
//
|
||||||
ctsSignedLongLong new_buffer_size = min<ctsUnsignedLongLong>(
|
ctsSignedLongLong new_buffer_size = min<ctsUnsignedLongLong>(
|
||||||
this->buffer_size,
|
ctsConfig::GetBufferSize(),
|
||||||
this->pattern_state.get_remaining_transfer());
|
this->pattern_state.get_remaining_transfer());
|
||||||
//
|
//
|
||||||
// second: if the protocol specified a ceiling, recalculate given their ceiling
|
// second: if the protocol specified a ceiling, recalculate given their ceiling
|
||||||
|
@ -676,9 +675,9 @@ namespace ctsTraffic {
|
||||||
this->recv_pattern_offset >= BufferPatternSize,
|
this->recv_pattern_offset >= BufferPatternSize,
|
||||||
L"pattern_offset being too large means we might walk off the end of our shared buffer (dt ctsTraffic!ctsTraffic::ctsIOPattern %p)", this);
|
L"pattern_offset being too large means we might walk off the end of our shared buffer (dt ctsTraffic!ctsTraffic::ctsIOPattern %p)", this);
|
||||||
ctFatalCondition(
|
ctFatalCondition(
|
||||||
return_task.buffer_length + return_task.buffer_offset > this->buffer_size,
|
return_task.buffer_length + return_task.buffer_offset > new_buffer_size,
|
||||||
L"return_task (%p) for a Recv request is specifying a buffer that is larger than this->buffer_size (%lu) (dt ctsTraffic!ctsTraffic::ctsIOPattern %p)",
|
L"return_task (%p) for a Recv request is specifying a buffer that is larger than buffer_size (%lu) (dt ctsTraffic!ctsTraffic::ctsIOPattern %p)",
|
||||||
&return_task, static_cast<unsigned long>(this->buffer_size), this);
|
&return_task, static_cast<unsigned long>(new_buffer_size), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return return_task;
|
return return_task;
|
||||||
|
|
|
@ -195,8 +195,6 @@ namespace ctsTraffic {
|
||||||
// track the state of the L4 protocol (TCP or UDP)
|
// track the state of the L4 protocol (TCP or UDP)
|
||||||
ctsIOPatternState pattern_state;
|
ctsIOPatternState pattern_state;
|
||||||
|
|
||||||
// need to know buffer size for each transfer
|
|
||||||
const ctsUnsignedLong buffer_size;
|
|
||||||
// need to track the current offset into the buffer pattern
|
// need to track the current offset into the buffer pattern
|
||||||
// these are separate as we could have both sends and receive operations on the same connection
|
// these are separate as we could have both sends and receive operations on the same connection
|
||||||
ctsSizeT send_pattern_offset;
|
ctsSizeT send_pattern_offset;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче