Merge "Don't read from closed sockets"
This commit is contained in:
@@ -297,6 +297,10 @@ int HttpSocket::Read(char* data, int len, int timeout_in_ms) {
|
||||
int total_read = 0;
|
||||
int to_read = len;
|
||||
|
||||
if (socket_fd_ == -1) {
|
||||
LOGE("Socket to %s not open. Cannot read.", domain_name_.c_str());
|
||||
return -1;
|
||||
}
|
||||
while (to_read > 0) {
|
||||
if (!SocketWait(socket_fd_, /* for_read */ true, timeout_in_ms)) {
|
||||
LOGE("unable to read from %s", domain_name_.c_str());
|
||||
@@ -332,6 +336,10 @@ int HttpSocket::Write(const char* data, int len, int timeout_in_ms) {
|
||||
int total_sent = 0;
|
||||
int to_send = len;
|
||||
|
||||
if (socket_fd_ == -1) {
|
||||
LOGE("Socket to %s not open. Cannot write.", domain_name_.c_str());
|
||||
return -1;
|
||||
}
|
||||
while (to_send > 0) {
|
||||
int sent;
|
||||
if (secure_connect_)
|
||||
|
||||
Reference in New Issue
Block a user