| 510 | } |
| 511 | |
| 512 | void NetworkThread::onSend(int fd) { |
| 513 | std::vector<int> invalid_fd; |
| 514 | |
| 515 | if (fd == -1) { |
| 516 | // LOG(INFO) << "There are " << fd_ip_map_.size() << " connections"; |
| 517 | // this is a signal of new message to send |
| 518 | for (auto &p : fd_ep_map_) { |
| 519 | // send message |
| 520 | // LOG(INFO) << "Try to send over fd " << p.first; |
| 521 | if (asyncSend(p.first) < 0) |
| 522 | invalid_fd.push_back(p.first); |
| 523 | } |
| 524 | } else { |
| 525 | if (asyncSend(fd) < 0) |
| 526 | invalid_fd.push_back(fd); |
| 527 | } |
| 528 | |
| 529 | for (auto &p : invalid_fd) { |
| 530 | // EndPoint* ep = epf_->getEp(fd_ip_map_.at(p)); |
| 531 | EndPoint *ep = fd_ep_map_.at(p); |
| 532 | std::unique_lock<std::mutex> lock(ep->mtx_); |
| 533 | handleConnLost(p, ep); |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | void NetworkThread::asyncSendPendingMsg(EndPoint *ep) { |
| 538 | // simply put the pending msgs to the send queue |
no outgoing calls
no test coverage detected