action are passed async

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1762 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2009-10-30 00:39:06 +00:00
parent 3c7f714650
commit fcaae207ef

View File

@ -577,14 +577,14 @@ bool CUPnPService::Execute(
const std::string &ActionName, const std::string &ActionName,
const std::vector<CUPnPArgumentValue> &ArgValue) const const std::vector<CUPnPArgumentValue> &ArgValue) const
{ {
std::ostringstream msg; std::cerr << "CUPnPService::Execute called.";
if (m_SCPD.get() == NULL) { if (m_SCPD.get() == NULL) {
std::cerr << "Service without SCPD Document, cannot execute action '" << ActionName << std::cerr << "Service without SCPD Document, cannot execute action '" << ActionName <<
"' for service '" << GetServiceType() << "'."; "' for service '" << GetServiceType() << "'.";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
std::ostringstream msgAction("Sending action "); std::cerr << "Sending action ";
// Check for correct action name // Check for correct action name
ActionList::const_iterator itAction = ActionList::const_iterator itAction =
m_SCPD->GetActionList().find(ActionName); m_SCPD->GetActionList().find(ActionName);
@ -594,7 +594,7 @@ bool CUPnPService::Execute(
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
msgAction << ActionName << "("; std::cerr << ActionName << "(";
bool firstTime = true; bool firstTime = true;
// Check for correct Argument/Value pairs // Check for correct Argument/Value pairs
const CUPnPAction &action = *(itAction->second); const CUPnPAction &action = *(itAction->second);
@ -676,6 +676,7 @@ bool CUPnPService::Execute(
} }
} }
} else { } else {
std::cerr << "UpnpMakeAction" << std::endl;
ActionDoc = UpnpMakeAction( ActionDoc = UpnpMakeAction(
action.GetName().c_str(), action.GetName().c_str(),
GetServiceType().c_str(), GetServiceType().c_str(),
@ -686,7 +687,7 @@ bool CUPnPService::Execute(
return false; return false;
} }
} }
#if 0
// Send the action asynchronously // Send the action asynchronously
UpnpSendActionAsync( UpnpSendActionAsync(
m_UPnPControlPoint.GetUPnPClientHandle(), m_UPnPControlPoint.GetUPnPClientHandle(),
@ -696,32 +697,32 @@ bool CUPnPService::Execute(
static_cast<Upnp_FunPtr>(&CUPnPControlPoint::Callback), static_cast<Upnp_FunPtr>(&CUPnPControlPoint::Callback),
NULL); NULL);
return true; return true;
#endif
// Send the action synchronously // std::cerr << "Calling UpnpSendAction." << std::endl;
IXML_Document *RespDoc = NULL; // // Send the action synchronously
int ret = UpnpSendAction( // IXML_Document *RespDoc = NULL;
m_UPnPControlPoint.GetUPnPClientHandle(), // int ret = UpnpSendAction(
GetAbsControlURL().c_str(), // m_UPnPControlPoint.GetUPnPClientHandle(),
GetServiceType().c_str(), // GetAbsControlURL().c_str(),
NULL, ActionDoc, &RespDoc); // GetServiceType().c_str(),
if (ret != UPNP_E_SUCCESS) { // NULL, ActionDoc, &RespDoc);
m_upnpLib.processUPnPErrorMessage( // if (ret != UPNP_E_SUCCESS) {
"UpnpSendAction", ret, NULL, RespDoc); // m_upnpLib.processUPnPErrorMessage(
ixmlDocument_free(ActionDoc); // "UpnpSendAction", ret, NULL, RespDoc);
ixmlDocument_free(RespDoc); // ixmlDocument_free(ActionDoc);
return false; // ixmlDocument_free(RespDoc);
} // return false;
ixmlDocument_free(ActionDoc); // }
// ixmlDocument_free(ActionDoc);
// Check the response document //
m_upnpLib.ProcessActionResponse( // // Check the response document
RespDoc, action.GetName()); // m_upnpLib.ProcessActionResponse(
// RespDoc, action.GetName());
// Free the response document //
ixmlDocument_free(RespDoc); // // Free the response document
// ixmlDocument_free(RespDoc);
return true; //
// return true;
} }