MCPcopy Create free account
hub / github.com/ceph/ceph / process

Method process

src/msg/async/AsyncConnection.cc:386–501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384}
385
386void AsyncConnection::process() {
387 std::lock_guard<std::mutex> l(lock);
388 last_active = ceph::coarse_mono_clock::now();
389 recv_start_time = ceph::mono_clock::now();
390
391 ldout(async_msgr->cct, 20) << __func__ << dendl;
392
393 switch (state) {
394 case STATE_NONE: {
395 ldout(async_msgr->cct, 20) << __func__ << " enter none state" << dendl;
396 return;
397 }
398 case STATE_CLOSED: {
399 ldout(async_msgr->cct, 20) << __func__ << " socket closed" << dendl;
400 return;
401 }
402 case STATE_CONNECTING: {
403 ceph_assert(!policy.server);
404
405 // clear timer (if any) since we are connecting/re-connecting
406 if (last_tick_id) {
407 center->delete_time_event(last_tick_id);
408 }
409 last_connect_started = ceph::coarse_mono_clock::now();
410 last_tick_id = center->create_time_event(
411 connect_timeout_us, tick_handler);
412
413 if (cs) {
414 center->delete_file_event(cs.fd(), EVENT_READABLE | EVENT_WRITABLE);
415 cs.close();
416 }
417
418 SocketOptions opts;
419 opts.priority = async_msgr->get_socket_priority();
420 if (async_msgr->cct->_conf->mon_use_min_delay_socket) {
421 if (async_msgr->get_mytype() == CEPH_ENTITY_TYPE_MON &&
422 peer_is_mon()) {
423 opts.priority = SOCKET_PRIORITY_MIN_DELAY;
424 }
425 }
426 opts.connect_bind_addr = msgr->get_myaddrs().front();
427 ssize_t r = worker->connect(target_addr, opts, &cs);
428 if (r < 0) {
429 protocol->fault();
430 return;
431 }
432
433 center->create_file_event(cs.fd(), EVENT_READABLE, read_handler);
434 state = STATE_CONNECTING_RE;
435 }
436 case STATE_CONNECTING_RE: {
437 ssize_t r = cs.is_connected();
438 if (r < 0) {
439 ldout(async_msgr->cct, 1) << __func__ << " reconnect failed to "
440 << target_addr << dendl;
441 if (r == -ECONNREFUSED) {
442 ldout(async_msgr->cct, 2)
443 << __func__ << " connection refused!" << dendl;

Callers 1

do_requestMethod · 0.45

Calls 15

delete_time_eventMethod · 0.80
create_time_eventMethod · 0.80
delete_file_eventMethod · 0.80
get_socket_priorityMethod · 0.80
create_file_eventMethod · 0.80
queue_refusedMethod · 0.80
get_familyMethod · 0.80
nowFunction · 0.50
readFunction · 0.50
fdMethod · 0.45
closeMethod · 0.45
get_mytypeMethod · 0.45

Tested by

no test coverage detected