Пример #1
0
/////////////////// Handlers of the Port Opening
OP_STATUS UPnPXH_IPRouted::HandleTokenAuto()
{
    OpString* conn_type=tags_parser.getTagValue(0);

    if(!GetDevice())
        return OpStatus::ERR_NULL_POINTER;

    if(GetLogic() && !upnp->IsDebugging(UPNP_DBG_NO_ROUTED) && !conn_type->Compare(UNI_L("IP_Routed")))
        return ((UPnPPortOpening *)GetLogic())->QueryNATEnabled(GetDevice());

    if(GetDevice()->IsPPP())
        NotifyFailure("No PPP IP_Routed");
    else
        NotifyFailure("No IP IP_Routed");

    return OpStatus::OK;
}
Пример #2
0
OP_STATUS UPnPXH_NATEnabled::HandleTokenAuto()
{
    OpString* nat_enabled=tags_parser.getTagValue(0);

    if(!GetDevice())
        return OpStatus::ERR_NULL_POINTER;

    if(GetLogic() && !upnp->IsDebugging(UPNP_DBG_NO_ROUTED) && !nat_enabled->Compare(UNI_L("1")))
    {
        return ((UPnPPortOpening *)GetLogic())->QueryExternalIP(GetDevice());
        //((UPnPPortOpening *)GetLogic())->QueryDisablePort();
        //return ((UPnPPortOpening *)GetLogic())->QueryIDGPortStatus();
        //return ((UPnPPortOpening *)GetLogic())->QueryDisablePort();
        //return ((UPnPPortOpening *)GetLogic())->QueryIDGPortStatus();
    }

    if(GetDevice()->IsPPP())
        NotifyFailure("No PPP NAT Enabled");
    else
        NotifyFailure("No IP NAT Enabled");

    return OpStatus::OK;
}
nsresult
nsUrlClassifierHashCompleterRequest::Begin()
{
  LOG(("nsUrlClassifierHashCompleterRequest::Begin [%p]", this));

  if (PR_IntervalNow() < mCompleter->GetNextRequestTime()) {
    NS_WARNING("Gethash server backed off, failing gethash request.");
    NotifyFailure(NS_ERROR_ABORT);
    return NS_ERROR_ABORT;
  }

  nsCOMPtr<nsIObserverService> observerService =
    do_GetService("@mozilla.org/observer-service;1");
  if (observerService)
    observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE);

  nsresult rv = OpenChannel();
  if (NS_FAILED(rv)) {
    NotifyFailure(rv);
    return rv;
  }

  return NS_OK;
}
NS_IMETHODIMP
nsUrlClassifierHashCompleterRequest::OnStopRequest(nsIRequest *request,
                                                   nsISupports *context,
                                                   nsresult status)
{
  LOG(("nsUrlClassifierHashCompleter::OnStopRequest [%p, status=%d]",
       this, status));

  nsCOMPtr<nsIObserverService> observerService =
    do_GetService("@mozilla.org/observer-service;1");
  if (observerService)
    observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);

  if (mShuttingDown)
    return NS_ERROR_ABORT;

  if (NS_SUCCEEDED(status)) {
    nsCOMPtr<nsIHttpChannel> channel = do_QueryInterface(request);
    if (channel) {
      PRBool success;
      status = channel->GetRequestSucceeded(&success);
      if (NS_SUCCEEDED(status) && !success) {
        status = NS_ERROR_ABORT;
      }
    }
  }

  mCompleter->NoteServerResponse(NS_SUCCEEDED(status));

  if (NS_SUCCEEDED(status))
    status = HandleResponse();

  // If we were rescheduled, don't bother notifying success or failure.
  if (!mRescheduled) {
    if (NS_SUCCEEDED(status))
      NotifySuccess();
    else
      NotifyFailure(status);
  }

  mChannel = nsnull;

  return NS_OK;
}
CLStatus CLDataPostResultNotifier::Notify(int Result)
{
	try
	{
		if(Result == MSG_POST_SUCCESS)
		{
			throw NotifySuccess();
		}
		else if(Result == MSG_POST_ERROR)
		{
			throw NotifyFailure();
		}

		throw CLStatus(-1, NORMAL_ERROR);
	}
	catch(CLStatus& s)
	{
		if((m_pMsg) && (m_bDeleteMsg))
			delete m_pMsg;

		return s;
	}
}