| 197 | } |
| 198 | |
| 199 | void RelayHandler::enqueue_message(const ACE_INET_Addr& addr, |
| 200 | const OpenDDS::DCPS::Lockable_Message_Block_Ptr& msg, |
| 201 | const OpenDDS::DCPS::MonotonicTimePoint& now, |
| 202 | MessageType type) |
| 203 | { |
| 204 | const Element out(addr, msg, now, type); |
| 205 | if (config_.synchronous_output()) { |
| 206 | size_t total_bytes; |
| 207 | |
| 208 | if (send_i(out, total_bytes) < 0) { |
| 209 | HANDLER_ERROR((LM_ERROR, "(%P|%t) ERROR: RelayHandler::enqueue_message %C failed to send to %C: %m\n", |
| 210 | name_.c_str(), OpenDDS::DCPS::LogAddr(out.address).c_str())); |
| 211 | stats_reporter_.dropped_message(total_bytes, OpenDDS::DCPS::TimeDuration::zero_value, OpenDDS::DCPS::TimeDuration::zero_value, now, out.type); |
| 212 | } else { |
| 213 | stats_reporter_.output_message(total_bytes, OpenDDS::DCPS::TimeDuration::zero_value, OpenDDS::DCPS::TimeDuration::zero_value, now, out.type); |
| 214 | } |
| 215 | |
| 216 | } else { |
| 217 | ACE_GUARD(ACE_Thread_Mutex, g, outgoing_mutex_); |
| 218 | |
| 219 | const auto empty = outgoing_.empty(); |
| 220 | |
| 221 | outgoing_.push(out); |
| 222 | stats_reporter_.max_queue_size(outgoing_.size(), now); |
| 223 | if (empty) { |
| 224 | reactor()->register_handler(this, WRITE_MASK); |
| 225 | } |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | ssize_t RelayHandler::send_i(const Element& out, |
| 230 | size_t& total_bytes) |
nothing calls this directly
no test coverage detected