0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

SERVER-28489 MockStream hook methods may still be used if the stream gets canceled

This commit is contained in:
samantharitter 2017-03-24 15:36:50 -04:00
parent cdf2e4cc29
commit 0230175542

View File

@ -209,7 +209,7 @@ void AsyncMockStreamFactory::MockStream::read(asio::mutable_buffer buf,
void AsyncMockStreamFactory::MockStream::pushRead(std::vector<uint8_t> toRead) {
stdx::unique_lock<stdx::mutex> lk(_mutex);
invariant(_state != kRunning && _state != kCanceled);
invariant(_state != kRunning);
_readQueue.emplace(std::move(toRead));
}
@ -219,7 +219,7 @@ void AsyncMockStreamFactory::MockStream::setError(std::error_code ec) {
std::vector<uint8_t> AsyncMockStreamFactory::MockStream::popWrite() {
stdx::unique_lock<stdx::mutex> lk(_mutex);
invariant(_state != kRunning && _state != kCanceled);
invariant(_state != kRunning);
auto nextWrite = std::move(_writeQueue.front());
_writeQueue.pop();
return nextWrite;