| 542 | } |
| 543 | |
| 544 | void Socket::ReleaseAllFailedWriteRequests(Socket::WriteRequest* req) { |
| 545 | CHECK(Failed() || IsWriteShutdown()); |
| 546 | int error_code; |
| 547 | std::string error_text; |
| 548 | if (Failed()) { |
| 549 | pthread_mutex_lock(&_id_wait_list_mutex); |
| 550 | error_code = non_zero_error_code(); |
| 551 | error_text = _error_text; |
| 552 | pthread_mutex_unlock(&_id_wait_list_mutex); |
| 553 | } else { |
| 554 | error_code = ESHUTDOWNWRITE; |
| 555 | error_text = "Shutdown write of the socket"; |
| 556 | } |
| 557 | // Notice that `req' is not tail if Address after IsWriteComplete fails. |
| 558 | do { |
| 559 | req = ReleaseWriteRequestsExceptLast(req, error_code, error_text); |
| 560 | if (!req->reset_pipelined_count_and_user_message()) { |
| 561 | CancelUnwrittenBytes(req->data.size()); |
| 562 | } |
| 563 | req->data.clear(); // MUST, otherwise IsWriteComplete is false |
| 564 | } while (!IsWriteComplete(req, true, NULL)); |
| 565 | ReturnFailedWriteRequest(req, error_code, error_text); |
| 566 | } |
| 567 | |
| 568 | int Socket::ResetFileDescriptor(int fd) { |
| 569 | // Reset message sizes when fd is changed. |
no test coverage detected