// Make sure the server got a connection and received the data
socket->close();
server.verifyConnection(buf, sizeof(buf));
+
+ ASSERT_TRUE(socket->isClosedBySelf());
+ ASSERT_FALSE(socket->isClosedByPeer());
}
/**
// Make sure the server got a connection and received the data
socket->close();
server.verifyConnection(buf, sizeof(buf));
+
+ ASSERT_TRUE(socket->isClosedBySelf());
+ ASSERT_FALSE(socket->isClosedByPeer());
}
/**
// Make sure the server got a connection and received the data
server.verifyConnection(buf, sizeof(buf));
+
+ ASSERT_TRUE(socket->isClosedBySelf());
+ ASSERT_FALSE(socket->isClosedByPeer());
}
/**
// Make sure the connection was aborted
CHECK_EQ(ccb.state, STATE_FAILED);
+
+ ASSERT_TRUE(socket->isClosedBySelf());
+ ASSERT_FALSE(socket->isClosedByPeer());
}
/**
// Make sure the connection was aborted
CHECK_EQ(ccb.state, STATE_FAILED);
+
+ ASSERT_TRUE(socket->isClosedBySelf());
+ ASSERT_FALSE(socket->isClosedByPeer());
}
/**
CHECK_EQ(ccb.state, STATE_FAILED);
CHECK_EQ(wcb.state, STATE_FAILED);
+
+ ASSERT_TRUE(socket->isClosedBySelf());
+ ASSERT_FALSE(socket->isClosedByPeer());
}
/**
CHECK_EQ(rcb.buffers.size(), 1);
CHECK_EQ(rcb.buffers[0].length, sizeof(buf));
CHECK_EQ(memcmp(rcb.buffers[0].buffer, buf, sizeof(buf)), 0);
+
+ ASSERT_FALSE(socket->isClosedBySelf());
+ ASSERT_FALSE(socket->isClosedByPeer());
}
/**
CHECK_EQ(ccb.state, STATE_FAILED); // we aborted the close attempt
CHECK_EQ(rcb.buffers.size(), 0);
CHECK_EQ(rcb.state, STATE_SUCCEEDED); // this indicates EOF
+
+ ASSERT_TRUE(socket->isClosedBySelf());
+ ASSERT_FALSE(socket->isClosedByPeer());
}
/**
CHECK_EQ(memcmp(buf1, readbuf, sizeof(buf1)), 0);
uint32_t bytesRead = acceptedSocket->read(readbuf, sizeof(readbuf));
CHECK_EQ(bytesRead, 0);
+
+ ASSERT_FALSE(socket->isClosedBySelf());
+ ASSERT_TRUE(socket->isClosedByPeer());
}
/**
CHECK_EQ(rcb.buffers[0].length, sizeof(acceptedWbuf));
CHECK_EQ(memcmp(rcb.buffers[0].buffer,
acceptedWbuf, sizeof(acceptedWbuf)), 0);
+
+ ASSERT_FALSE(socket->isClosedBySelf());
+ ASSERT_FALSE(socket->isClosedByPeer());
}
/**
// Fully close both sockets
acceptedSocket->close();
socket->close();
+
+ ASSERT_FALSE(socket->isClosedBySelf());
+ ASSERT_TRUE(socket->isClosedByPeer());
}
/**
// Fully close both sockets
acceptedSocket->close();
socket->close();
+
+ ASSERT_FALSE(socket->isClosedBySelf());
+ ASSERT_TRUE(socket->isClosedByPeer());
}
// Helper function for use in testConnectOptWrite()
// Make sure the server got a connection and received the data
socket->close();
server.verifyConnection(buf, sizeof(buf));
+
+ ASSERT_TRUE(socket->isClosedBySelf());
+ ASSERT_FALSE(socket->isClosedByPeer());
}
/**
CHECK_EQ(wcb.state, STATE_FAILED);
CHECK_EQ(wcb.exception.getType(),
AsyncSocketException::INTERNAL_ERROR);
+
+ ASSERT_FALSE(socket->isClosedBySelf());
+ ASSERT_FALSE(socket->isClosedByPeer());
}
/**
acceptedSocket->close();
socket->close();
+
+ ASSERT_TRUE(socket->isClosedBySelf());
+ ASSERT_FALSE(socket->isClosedByPeer());
}
TEST(AsyncSocketTest, WriteIOBufCorked) {
acceptedSocket->close();
socket->close();
+
+ ASSERT_TRUE(socket->isClosedBySelf());
+ ASSERT_FALSE(socket->isClosedByPeer());
}
/**
CHECK_EQ(wcb3.state, STATE_SUCCEEDED);
CHECK_EQ(wcb4.state, STATE_SUCCEEDED);
rcb.verifyData(buf.get(), len1 + len2);
+
+ ASSERT_TRUE(socket->isClosedBySelf());
+ ASSERT_FALSE(socket->isClosedByPeer());
}
TEST(AsyncSocketTest, ZeroLengthWritev) {
CHECK_EQ(wcb.state, STATE_SUCCEEDED);
rcb.verifyData(buf.get(), len1 + len2);
+
+ ASSERT_TRUE(socket->isClosedBySelf());
+ ASSERT_FALSE(socket->isClosedByPeer());
}
///////////////////////////////////////////////////////////////////////////
++it) {
CHECK_EQ((*it)->state, STATE_FAILED);
}
+
+ ASSERT_TRUE(socket->isClosedBySelf());
+ ASSERT_FALSE(socket->isClosedByPeer());
}
///////////////////////////////////////////////////////////////////////////
CHECK_EQ(wcb1.state, STATE_SUCCEEDED);
rcb.verifyData(expectedData, expectedDataSz);
CHECK_EQ(socket.immediateReadCalled, true);
+
+ ASSERT_FALSE(socket.isClosedBySelf());
+ ASSERT_FALSE(socket.isClosedByPeer());
}
TEST(AsyncSocket, ConnectReadUninstallRead) {
* was reset in dataAvailableCallback */
CHECK_EQ(rcb.dataRead(), maxBufferSz);
CHECK_EQ(socket.immediateReadCalled, false);
+
+ ASSERT_FALSE(socket.isClosedBySelf());
+ ASSERT_FALSE(socket.isClosedByPeer());
}
// TODO: