| 124 | } |
| 125 | |
| 126 | void ProtocolV1::fault() { |
| 127 | ldout(cct, 20) << __func__ << dendl; |
| 128 | |
| 129 | if (state == CLOSED || state == NONE) { |
| 130 | ldout(cct, 10) << __func__ << " connection is already closed" << dendl; |
| 131 | return; |
| 132 | } |
| 133 | |
| 134 | if (connection->policy.lossy && state != START_CONNECT && |
| 135 | state != CONNECTING) { |
| 136 | ldout(cct, 1) << __func__ << " on lossy channel, failing" << dendl; |
| 137 | stop(); |
| 138 | connection->dispatch_queue->queue_reset(connection); |
| 139 | return; |
| 140 | } |
| 141 | |
| 142 | connection->write_lock.lock(); |
| 143 | can_write = WriteStatus::NOWRITE; |
| 144 | is_reset_from_peer = false; |
| 145 | |
| 146 | // requeue sent items |
| 147 | requeue_sent(); |
| 148 | |
| 149 | if (!once_ready && out_q.empty() && state >= START_ACCEPT && |
| 150 | state <= ACCEPTING_WAIT_CONNECT_MSG_AUTH && !replacing) { |
| 151 | ldout(cct, 10) << __func__ << " with nothing to send and in the half " |
| 152 | << " accept state just closed" << dendl; |
| 153 | connection->write_lock.unlock(); |
| 154 | stop(); |
| 155 | connection->dispatch_queue->queue_reset(connection); |
| 156 | return; |
| 157 | } |
| 158 | replacing = false; |
| 159 | |
| 160 | connection->fault(); |
| 161 | |
| 162 | reset_recv_state(); |
| 163 | |
| 164 | if (connection->policy.standby && out_q.empty() && !keepalive && |
| 165 | state != WAIT) { |
| 166 | ldout(cct, 10) << __func__ << " with nothing to send, going to standby" |
| 167 | << dendl; |
| 168 | state = STANDBY; |
| 169 | connection->write_lock.unlock(); |
| 170 | return; |
| 171 | } |
| 172 | |
| 173 | connection->write_lock.unlock(); |
| 174 | |
| 175 | if ((state >= START_CONNECT && state <= CONNECTING_SEND_CONNECT_MSG) || |
| 176 | state == WAIT) { |
| 177 | // backoff! |
| 178 | if (state == WAIT) { |
| 179 | backoff.set_from_double(cct->_conf->ms_max_backoff); |
| 180 | } else if (backoff == utime_t()) { |
| 181 | backoff.set_from_double(cct->_conf->ms_initial_backoff); |
| 182 | } else { |
| 183 | backoff += backoff; |
nothing calls this directly
no test coverage detected