| 42 | } |
| 43 | |
| 44 | ProgressiveAttachment::~ProgressiveAttachment() { |
| 45 | if (_httpsock) { |
| 46 | CHECK(_rpc_state.load(butil::memory_order_relaxed) != RPC_RUNNING); |
| 47 | CHECK(_saved_buf.empty()); |
| 48 | if (!_before_http_1_1) { |
| 49 | // note: _httpsock may already be failed. |
| 50 | if (_rpc_state.load(butil::memory_order_relaxed) == RPC_SUCCEED) { |
| 51 | butil::IOBuf tmpbuf; |
| 52 | tmpbuf.append("0\r\n\r\n", 5); |
| 53 | Socket::WriteOptions wopt; |
| 54 | wopt.ignore_eovercrowded = true; |
| 55 | _httpsock->Write(&tmpbuf, &wopt); |
| 56 | } |
| 57 | } else { |
| 58 | // Close _httpsock to notify the client that all the content has |
| 59 | // been transferred. |
| 60 | // Note: invoke ReleaseAdditionalReference instead of SetFailed to |
| 61 | // make sure that all the data has been written before the fd is |
| 62 | // closed. |
| 63 | _httpsock->ReleaseAdditionalReference(); |
| 64 | } |
| 65 | } |
| 66 | if (_notify_id != INVALID_BTHREAD_ID) { |
| 67 | bthread_id_error(_notify_id, 0); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | static char s_hex_map[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', |
| 72 | '9', 'A', 'B', 'C', 'D', 'E', 'F' }; |
nothing calls this directly
no test coverage detected