Пример #1
0
FT::FaultNotifier::ConsumerId TAO::FT_FaultNotifier_i::connect_sequence_fault_consumer (
    CosNotifyComm::SequencePushConsumer_ptr push_consumer,
    CosNotifyFilter::Filter_ptr filter
)
{
    METHOD_ENTRY(TAO::FT_FaultNotifier_i::connect_sequence_fault_consumer);
    /////////////////////////
    // find a ProxyInfo entry
    // use the first nil entry or a new entry if no nils found

    size_t infoPos = 0;
    int looking = 1;
    for ( size_t pos = 0; looking && pos < this->proxy_infos_.size (); ++pos)
    {
        ProxyInfo & pi = this->proxy_infos_[pos];
        if (CORBA::is_nil(pi.proxyVar_.in ()))
        {
            infoPos = pos;
            looking = 0;
        }
    }
    if (looking)
    {
        infoPos = this->proxy_infos_.size();
        this->proxy_infos_.push_back(ProxyInfo());
    }

    ///////////////////////////////////////
    // Assign an ID, populate the ProxyInfo
    FT::FaultNotifier::ConsumerId result = infoPos;
    ProxyInfo & info = this->proxy_infos_[infoPos];
    info.proxyVar_
        = this->consumer_admin_->obtain_notification_push_supplier (
              ::CosNotifyChannelAdmin::SEQUENCE_EVENT,
              info.proxyId_);

    this->consumer_connects_ += 1;

    ::CosNotifyChannelAdmin::SequenceProxyPushSupplier_var proxySupplier
        = ::CosNotifyChannelAdmin::SequenceProxyPushSupplier::_narrow(info.proxyVar_.in ());
    if ( CORBA::is_nil (proxySupplier.in ()))
    {
        // this is a shoould-not-occur situation.  The consumer admin returned
        // the wrong kind of object.
        ORBSVCS_ERROR(( LM_ERROR,
                        "%T %n (%P|%t) Unexpected result: Wrong type of object returned from obtain_notification_push_supplier\n"
                      ));
    }
    else
    {
        proxySupplier->connect_sequence_push_consumer ( push_consumer);

        if (! CORBA::is_nil (filter))
        {
            proxySupplier->add_filter(filter);
        }
    }
    METHOD_RETURN(TAO::FT_FaultNotifier_i::connect_sequence_fault_consumer) result;
}
Пример #2
0
ProxyInfo NetworkProxy::getHttpProxy(const std::string &) {
  ProxyInfo proxyInfo; // NoProxy.
  char *proxy_var = getenv("http_proxy");
  if (proxy_var == 0)
    proxy_var = getenv("HTTP_PROXY");

  if (proxy_var != 0) {
    Poco::URI uri_p(proxy_var);
    proxyInfo =
        ProxyInfo(uri_p.getHost(), uri_p.getPort(), true /*http proxy*/);
  }
  return proxyInfo;
}
Пример #3
0
        {
          proxyServer = proxy_option;
          proxyPort = 8080; // default port for proxy
        } else {
          proxyServer =
              std::string(proxy_option.begin(), proxy_option.begin() + pos);
          std::stringstream port_str;
          port_str << std::string(proxy_option.begin() + pos + 1,
                                  proxy_option.end());
          port_str >> proxyPort;
        }
      } else {
        proxyServer = proxy_option;
        proxyPort = 8080;
      }
    }
    proxyInfo = ProxyInfo(proxyServer, proxyPort, true);
  } else {
    m_logger.information() << "NetworkProxyWin failed to find the proxy "
                              "information. It will attempt without proxy. "
                           << errmsg << std::endl;
  }

  return proxyInfo;
}

} // namespace Kernel
} // namespace Mantid

#endif