| 320 | } |
| 321 | |
| 322 | CtPtr ProtocolV2::_fault() { |
| 323 | ldout(cct, 10) << __func__ << dendl; |
| 324 | |
| 325 | if (state == CLOSED || state == NONE) { |
| 326 | ldout(cct, 10) << __func__ << " connection is already closed" << dendl; |
| 327 | return nullptr; |
| 328 | } |
| 329 | |
| 330 | if (connection->policy.lossy && |
| 331 | !(state >= START_CONNECT && state <= SESSION_RECONNECTING)) { |
| 332 | ldout(cct, 2) << __func__ << " on lossy channel, failing" << dendl; |
| 333 | stop(); |
| 334 | connection->dispatch_queue->queue_reset(connection); |
| 335 | return nullptr; |
| 336 | } |
| 337 | |
| 338 | connection->write_lock.lock(); |
| 339 | |
| 340 | can_write = false; |
| 341 | // requeue sent items |
| 342 | requeue_sent(); |
| 343 | |
| 344 | if (out_queue.empty() && state >= START_ACCEPT && |
| 345 | state <= SESSION_ACCEPTING && !replacing) { |
| 346 | ldout(cct, 2) << __func__ << " with nothing to send and in the half " |
| 347 | << " accept state just closed" << dendl; |
| 348 | connection->write_lock.unlock(); |
| 349 | stop(); |
| 350 | connection->dispatch_queue->queue_reset(connection); |
| 351 | return nullptr; |
| 352 | } |
| 353 | |
| 354 | replacing = false; |
| 355 | connection->fault(); |
| 356 | reset_recv_state(); |
| 357 | |
| 358 | reconnecting = false; |
| 359 | |
| 360 | if (connection->policy.standby && out_queue.empty() && !keepalive && |
| 361 | state != WAIT) { |
| 362 | ldout(cct, 1) << __func__ << " with nothing to send, going to standby" |
| 363 | << dendl; |
| 364 | state = STANDBY; |
| 365 | connection->write_lock.unlock(); |
| 366 | return nullptr; |
| 367 | } |
| 368 | if (connection->policy.server) { |
| 369 | ldout(cct, 1) << __func__ << " server, going to standby, even though i have stuff queued" << dendl; |
| 370 | state = STANDBY; |
| 371 | connection->write_lock.unlock(); |
| 372 | return nullptr; |
| 373 | } |
| 374 | |
| 375 | connection->write_lock.unlock(); |
| 376 | |
| 377 | if (!(state >= START_CONNECT && state <= SESSION_RECONNECTING) && |
| 378 | state != WAIT && |
| 379 | state != SESSION_ACCEPTING /* due to connection race */) { |
nothing calls this directly
no test coverage detected