void SpectatordPublisher::setup_unix_domain()

in spectator/publisher.cc [52:75]


void SpectatordPublisher::setup_unix_domain(absl::string_view path) {
  local_reconnect(path);
  // get a copy of the file path
  std::string local_path{path};
  sender_ = [local_path, this](std::string_view msg) {
    buffer_.append(msg);
    if (buffer_.length() >= bytes_to_buffer_) {
      for (auto i = 0; i < 3; ++i) {
        try {
          auto sent_bytes = local_socket_.send(asio::buffer(buffer_));
          logger_->trace("Sent (local): {} bytes, in total had {}", sent_bytes, buffer_.length());
          break;
        } catch (std::exception& e) {
          local_reconnect(local_path);
          logger_->warn("Unable to send {} - attempt {}/3 ({})", buffer_, i,
                        e.what());
        }
      }
      buffer_.clear();
    } else {
      buffer_.push_back(NEW_LINE);
    }   
  };
}