MCPcopy Create free account
hub / github.com/apache/singa / onSend

Method onSend

src/io/network/endpoint.cc:512–535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

510}
511
512void 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
537void NetworkThread::asyncSendPendingMsg(EndPoint *ep) {
538 // simply put the pending msgs to the send queue

Callers 2

async_msg_cbFunction · 0.80
writable_cbFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected