| 163 | } |
| 164 | |
| 165 | int RelayHandler::handle_output(ACE_HANDLE handle) |
| 166 | { |
| 167 | auto& statusManager = TheServiceParticipant->get_thread_status_manager(); |
| 168 | OpenDDS::DCPS::ThreadStatusManager::Event ev(statusManager, WRITE_MASK, handle_to_int(handle)); |
| 169 | |
| 170 | const auto now = OpenDDS::DCPS::MonotonicTimePoint::now(); |
| 171 | |
| 172 | ACE_GUARD_RETURN(ACE_Thread_Mutex, g, outgoing_mutex_, 0); |
| 173 | OpenDDS::DCPS::ThreadStatusManager::Event evLocked(statusManager, WRITE_MASK | DONT_CALL, handle_to_int(handle)); |
| 174 | |
| 175 | if (!outgoing_.empty()) { |
| 176 | const auto& out = outgoing_.front(); |
| 177 | size_t total_bytes; |
| 178 | |
| 179 | if (send_i(out, total_bytes) < 0) { |
| 180 | HANDLER_ERROR((LM_ERROR, "(%P|%t) ERROR: RelayHandler::handle_output %C failed to send to %C: %m\n", |
| 181 | name_.c_str(), OpenDDS::DCPS::LogAddr(out.address).c_str())); |
| 182 | const auto new_now = OpenDDS::DCPS::MonotonicTimePoint::now(); |
| 183 | stats_reporter_.dropped_message(total_bytes, new_now - now, new_now - out.timestamp, now, out.type); |
| 184 | } else { |
| 185 | const auto new_now = OpenDDS::DCPS::MonotonicTimePoint::now(); |
| 186 | stats_reporter_.output_message(total_bytes, new_now - now, new_now - out.timestamp, now, out.type); |
| 187 | } |
| 188 | |
| 189 | outgoing_.pop(); |
| 190 | } |
| 191 | |
| 192 | if (outgoing_.empty()) { |
| 193 | reactor()->remove_handler(this, WRITE_MASK); |
| 194 | } |
| 195 | |
| 196 | return 0; |
| 197 | } |
| 198 | |
| 199 | void RelayHandler::enqueue_message(const ACE_INET_Addr& addr, |
| 200 | const OpenDDS::DCPS::Lockable_Message_Block_Ptr& msg, |
nothing calls this directly
no test coverage detected