diff --git a/livesupport/src/modules/storageClient/include/LiveSupport/Storage/StorageClientInterface.h b/livesupport/src/modules/storageClient/include/LiveSupport/Storage/StorageClientInterface.h
index 0b036a67e..dfcf0ea71 100644
--- a/livesupport/src/modules/storageClient/include/LiveSupport/Storage/StorageClientInterface.h
+++ b/livesupport/src/modules/storageClient/include/LiveSupport/Storage/StorageClientInterface.h
@@ -420,45 +420,6 @@ class StorageClientInterface
throw (XmlRpcException)
= 0;
- /**
- * The possible states of an asynchronous transport process.
- */
- typedef enum { initState,
- pendingState,
- finishedState,
- closedState,
- failedState } TransportState;
-
- /**
- * Check the status of the asynchronous network transport operation.
- *
- * If the return value is
- *
- initState or pendingState, then the operation
- * is in progress, and you need to call this function again until
- * a different value is returned;
- * - finishedState, then the asynchronous XML-RPC call has
- * completed normally;
- * - closedState, then the transport has been
- * closed or canceled, and the token is no longer valid;
- * - failedState, then an error has occured (and the token is
- * no longer valid); the error message is returned in the (optional)
- * errorMessage return parameter.
- *
- *
- * @param token the transport token of an asynchronous method.
- * @param errorMessage return parameter: if the transport has failed,
- * this will contain the error message (optional).
- * @return the state of the transport.
- * @exception XmlRpcException if there is a problem with the XML-RPC
- * call.
- */
- virtual TransportState
- checkTransport(Ptr::Ref token,
- Ptr::Ref errorMessage
- = Ptr::Ref())
- throw (XmlRpcException)
- = 0;
-
/**
* Return the list of audio clip IDs found by the search method.
*
@@ -619,6 +580,60 @@ class StorageClientInterface
throw (XmlRpcException)
= 0;
+ /**
+ * The possible states of an asynchronous transport process.
+ */
+ typedef enum { initState,
+ pendingState,
+ finishedState,
+ closedState,
+ failedState } TransportState;
+
+ /**
+ * Check the status of the asynchronous network transport operation.
+ *
+ * If the return value is
+ * - initState or pendingState, then the operation
+ * is in progress, and you need to call this function again until
+ * a different value is returned;
+ * - finishedState, then the asynchronous XML-RPC call has
+ * completed normally;
+ * - closedState, then the transport has been
+ * closed or canceled, and the token is no longer valid;
+ * - failedState, then an error has occured (and the token is
+ * no longer valid); the error message is returned in the (optional)
+ * errorMessage return parameter.
+ *
+ *
+ * @param token the transport token of an asynchronous method.
+ * @param errorMessage return parameter: if the transport has failed,
+ * this will contain the error message (optional).
+ * @return the state of the transport.
+ * @exception XmlRpcException if there is a problem with the XML-RPC
+ * call.
+ */
+ virtual TransportState
+ checkTransport(Ptr::Ref token,
+ Ptr::Ref errorMessage
+ = Ptr::Ref())
+ throw (XmlRpcException)
+ = 0;
+
+ /**
+ * Cancel an asynchronous network transport operation.
+ *
+ * @param sessionId the session ID from the authentication client.
+ * @param token the transport token of an asynchronous method.
+ * @return the state of the transport.
+ * @exception XmlRpcException if there is a problem with the XML-RPC
+ * call.
+ */
+ virtual void
+ cancelTransport(Ptr::Ref sessionId,
+ Ptr::Ref token)
+ throw (XmlRpcException)
+ = 0;
+
/**
* A virtual destructor, as this class has virtual functions.
*/
diff --git a/livesupport/src/modules/storageClient/src/TestStorageClient.cxx b/livesupport/src/modules/storageClient/src/TestStorageClient.cxx
index c83055bb6..23ec76bca 100644
--- a/livesupport/src/modules/storageClient/src/TestStorageClient.cxx
+++ b/livesupport/src/modules/storageClient/src/TestStorageClient.cxx
@@ -859,25 +859,6 @@ TestStorageClient :: remoteSearchClose(Ptr::Ref token)
}
-/*------------------------------------------------------------------------------
- * Check the status of the asynchronous network transport operation.
- *----------------------------------------------------------------------------*/
-StorageClientInterface::TransportState
-TestStorageClient :: checkTransport(Ptr::Ref token,
- Ptr::Ref errorMessage)
- throw (XmlRpcException)
-{
- if (token && *token == "fake_token") {
- return pendingState;
- } else {
- if (errorMessage) {
- errorMessage->assign("bad token");
- }
- return failedState;
- }
-}
-
-
/*------------------------------------------------------------------------------
* See if the Playable instance satisfies the search criteria
*----------------------------------------------------------------------------*/
@@ -1097,3 +1078,33 @@ TestStorageClient :: exportPlaylistClose(
{
}
+
+/*------------------------------------------------------------------------------
+ * Check the status of the asynchronous network transport operation.
+ *----------------------------------------------------------------------------*/
+StorageClientInterface::TransportState
+TestStorageClient :: checkTransport(Ptr::Ref token,
+ Ptr::Ref errorMessage)
+ throw (XmlRpcException)
+{
+ if (token && *token == "fake_token") {
+ return pendingState;
+ } else {
+ if (errorMessage) {
+ errorMessage->assign("bad token");
+ }
+ return failedState;
+ }
+}
+
+
+/*------------------------------------------------------------------------------
+ * Cancel an asynchronous network transport operation.
+ *----------------------------------------------------------------------------*/
+void
+TestStorageClient :: cancelTransport(Ptr::Ref sessionId,
+ Ptr::Ref token)
+ throw (XmlRpcException)
+{
+}
+
diff --git a/livesupport/src/modules/storageClient/src/TestStorageClient.h b/livesupport/src/modules/storageClient/src/TestStorageClient.h
index 13652eeaf..7d6a37723 100644
--- a/livesupport/src/modules/storageClient/src/TestStorageClient.h
+++ b/livesupport/src/modules/storageClient/src/TestStorageClient.h
@@ -569,35 +569,6 @@ class TestStorageClient :
remoteSearchClose(Ptr::Ref token)
throw (XmlRpcException);
- /**
- * Check the status of the asynchronous network transport operation.
- *
- * If the return value is
- * - initState or pendingState, then the operation
- * is in progress, and you need to call this function again until
- * a different value is returned;
- * - finishedState, then the asynchronous XML-RPC call has
- * completed normally;
- * - closedState, then the transport has been
- * closed or canceled, and the token is no longer valid;
- * - failedState, then an error has occured (and the token is
- * no longer valid); the error message is returned in the (optional)
- * errorMessage return parameter.
- *
- *
- * @param token the transport token of an asynchronous method.
- * @param errorMessage return parameter: if the transport has failed,
- * this will contain the error message (optional).
- * @return the state of the transport.
- * @exception XmlRpcException if there is a problem with the XML-RPC
- * call.
- */
- virtual TransportState
- checkTransport(Ptr::Ref token,
- Ptr::Ref errorMessage
- = Ptr::Ref())
- throw (XmlRpcException);
-
/**
* Return the list of audio clip IDs found by the search method.
*
@@ -740,6 +711,49 @@ class TestStorageClient :
virtual void
exportPlaylistClose(Ptr::Ref token) const
throw (XmlRpcException);
+
+ /**
+ * Check the status of the asynchronous network transport operation.
+ *
+ * If the return value is
+ * - initState or pendingState, then the operation
+ * is in progress, and you need to call this function again until
+ * a different value is returned;
+ * - finishedState, then the asynchronous XML-RPC call has
+ * completed normally;
+ * - closedState, then the transport has been
+ * closed or canceled, and the token is no longer valid;
+ * - failedState, then an error has occured (and the token is
+ * no longer valid); the error message is returned in the (optional)
+ * errorMessage return parameter.
+ *
+ *
+ * @param token the transport token of an asynchronous method.
+ * @param errorMessage return parameter: if the transport has failed,
+ * this will contain the error message (optional).
+ * @return the state of the transport.
+ * @exception XmlRpcException if there is a problem with the XML-RPC
+ * call.
+ */
+ virtual TransportState
+ checkTransport(Ptr::Ref token,
+ Ptr::Ref errorMessage
+ = Ptr::Ref())
+ throw (XmlRpcException);
+
+ /**
+ * Cancel an asynchronous network transport operation.
+ *
+ * @param sessionId the session ID from the authentication client.
+ * @param token the transport token of an asynchronous method.
+ * @return the state of the transport.
+ * @exception XmlRpcException if there is a problem with the XML-RPC
+ * call.
+ */
+ virtual void
+ cancelTransport(Ptr::Ref sessionId,
+ Ptr::Ref token)
+ throw (XmlRpcException);
};
diff --git a/livesupport/src/modules/storageClient/src/TestStorageClientTest.cxx b/livesupport/src/modules/storageClient/src/TestStorageClientTest.cxx
index c1d3033de..e3bf91c08 100644
--- a/livesupport/src/modules/storageClient/src/TestStorageClientTest.cxx
+++ b/livesupport/src/modules/storageClient/src/TestStorageClientTest.cxx
@@ -560,5 +560,9 @@ TestStorageClientTest :: remoteSearchTest(void)
CPPUNIT_ASSERT_THROW(
tsc->remoteSearchClose(token), XmlRpcMethodFaultException
);
+
+ CPPUNIT_ASSERT_NO_THROW(
+ tsc->cancelTransport(dummySessionId, token);
+ );
}
diff --git a/livesupport/src/modules/storageClient/src/WebStorageClient.cxx b/livesupport/src/modules/storageClient/src/WebStorageClient.cxx
index 73d11e61c..87f36cc18 100644
--- a/livesupport/src/modules/storageClient/src/WebStorageClient.cxx
+++ b/livesupport/src/modules/storageClient/src/WebStorageClient.cxx
@@ -785,7 +785,7 @@ const std::string remoteSearchTokenParamName = "trtok";
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ storage server constants: checkTransport */
/*------------------------------------------------------------------------------
- * The name of the check transport method on the storage server
+ * The name of the check transport method on the storage server
*----------------------------------------------------------------------------*/
const std::string checkTransportMethodName = "locstor.getTransportInfo";
@@ -804,6 +804,29 @@ const std::string checkTransportStateParamName = "state";
*----------------------------------------------------------------------------*/
const std::string checkTransportErrorMessageParamName = "errmsg";
+
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ storage server constants: doTransportAction */
+
+/*------------------------------------------------------------------------------
+ * The name of the do transport action method on the storage server
+ *----------------------------------------------------------------------------*/
+const std::string doTransportActionMethodName = "locstor.doTransportAction";
+
+/*------------------------------------------------------------------------------
+ * The name of the session ID parameter in the input structure
+ *----------------------------------------------------------------------------*/
+const std::string doTransportActionSessionIdParamName = "sessid";
+
+/*------------------------------------------------------------------------------
+ * The name of the token parameter in the input structure
+ *----------------------------------------------------------------------------*/
+const std::string doTransportActionTokenParamName = "trtok";
+
+/*------------------------------------------------------------------------------
+ * The name of the action parameter in the input structure
+ *----------------------------------------------------------------------------*/
+const std::string doTransportActionActionParamName = "action";
+
}
/* =============================================== local function prototypes */
@@ -2180,58 +2203,6 @@ WebStorageClient :: remoteSearchClose(Ptr::Ref token)
}
-/*------------------------------------------------------------------------------
- * Check the status of the asynchronous network transport operation.
- *----------------------------------------------------------------------------*/
-StorageClientInterface::TransportState
-WebStorageClient :: checkTransport(Ptr::Ref token,
- Ptr::Ref errorMessage)
- throw (XmlRpcException)
-{
- XmlRpcValue parameters;
- XmlRpcValue result;
-
- parameters.clear();
- parameters[checkTransportTokenParamName]
- = std::string(*token);
-
- execute(checkTransportMethodName, parameters, result);
-
- checkStruct(checkTransportMethodName,
- result,
- checkTransportStateParamName,
- XmlRpcValue::TypeString);
-
- std::string state = result[checkTransportStateParamName];
- if (state == "init") {
- return initState;
- } else if (state == "pending") {
- return pendingState;
- } else if (state == "finished") {
- return finishedState;
- } else if (state == "closed") {
- return closedState;
- } else if (state == "failed") {
- if (errorMessage) {
- checkStruct(checkTransportMethodName,
- result,
- checkTransportErrorMessageParamName,
- XmlRpcValue::TypeString);
- errorMessage->assign(std::string(
- result[checkTransportErrorMessageParamName]));
- }
- return failedState;
- } else {
- std::stringstream eMsg;
- eMsg << "Unrecognized transport state returned by XML-RPC method '"
- << checkTransportMethodName
- << "':\n"
- << result;
- throw XmlRpcMethodResponseException(eMsg.str());
- }
-}
-
-
/*------------------------------------------------------------------------------
* Return a list of all playlists in the storage.
*----------------------------------------------------------------------------*/
@@ -2462,3 +2433,78 @@ WebStorageClient :: exportPlaylistClose(
execute(exportPlaylistCloseMethodName, parameters, result);
}
+
+/*------------------------------------------------------------------------------
+ * Check the status of the asynchronous network transport operation.
+ *----------------------------------------------------------------------------*/
+StorageClientInterface::TransportState
+WebStorageClient :: checkTransport(Ptr::Ref token,
+ Ptr::Ref errorMessage)
+ throw (XmlRpcException)
+{
+ XmlRpcValue parameters;
+ XmlRpcValue result;
+
+ parameters.clear();
+ parameters[checkTransportTokenParamName]
+ = std::string(*token);
+
+ execute(checkTransportMethodName, parameters, result);
+
+ checkStruct(checkTransportMethodName,
+ result,
+ checkTransportStateParamName,
+ XmlRpcValue::TypeString);
+
+ std::string state = result[checkTransportStateParamName];
+ if (state == "init") {
+ return initState;
+ } else if (state == "pending") {
+ return pendingState;
+ } else if (state == "finished") {
+ return finishedState;
+ } else if (state == "closed") {
+ return closedState;
+ } else if (state == "failed") {
+ if (errorMessage) {
+ checkStruct(checkTransportMethodName,
+ result,
+ checkTransportErrorMessageParamName,
+ XmlRpcValue::TypeString);
+ errorMessage->assign(std::string(
+ result[checkTransportErrorMessageParamName]));
+ }
+ return failedState;
+ } else {
+ std::stringstream eMsg;
+ eMsg << "Unrecognized transport state returned by XML-RPC method '"
+ << checkTransportMethodName
+ << "':\n"
+ << result;
+ throw XmlRpcMethodResponseException(eMsg.str());
+ }
+}
+
+
+/*------------------------------------------------------------------------------
+ * Cancel an asynchronous network transport operation.
+ *----------------------------------------------------------------------------*/
+void
+WebStorageClient :: cancelTransport(Ptr::Ref sessionId,
+ Ptr::Ref token)
+ throw (XmlRpcException)
+{
+ XmlRpcValue parameters;
+ XmlRpcValue result;
+
+ parameters.clear();
+ parameters[doTransportActionSessionIdParamName]
+ = sessionId->getId();
+ parameters[doTransportActionTokenParamName]
+ = std::string(*token);
+ parameters[doTransportActionActionParamName]
+ = "cancel";
+
+ execute(doTransportActionMethodName, parameters, result);
+}
+
diff --git a/livesupport/src/modules/storageClient/src/WebStorageClient.h b/livesupport/src/modules/storageClient/src/WebStorageClient.h
index 573b5d76e..78612ceaa 100644
--- a/livesupport/src/modules/storageClient/src/WebStorageClient.h
+++ b/livesupport/src/modules/storageClient/src/WebStorageClient.h
@@ -664,35 +664,6 @@ class WebStorageClient :
remoteSearchClose(Ptr::Ref token)
throw (XmlRpcException);
- /**
- * Check the status of the asynchronous network transport operation.
- *
- * If the return value is
- * - initState or pendingState, then the operation
- * is in progress, and you need to call this function again until
- * a different value is returned;
- * - finishedState, then the asynchronous XML-RPC call has
- * completed normally;
- * - closedState, then the transport has been
- * closed or canceled, and the token is no longer valid;
- * - failedState, then an error has occured (and the token is
- * no longer valid); the error message is returned in the (optional)
- * errorMessage return parameter.
- *
- *
- * @param token the transport token of an asynchronous method.
- * @param errorMessage return parameter: if the transport has failed,
- * this will contain the error message (optional).
- * @return the state of the transport.
- * @exception XmlRpcException if there is a problem with the XML-RPC
- * call.
- */
- virtual TransportState
- checkTransport(Ptr::Ref token,
- Ptr::Ref errorMessage
- = Ptr::Ref())
- throw (XmlRpcException);
-
/**
* Return the list of playlist IDs found by the search method.
*
@@ -832,6 +803,49 @@ class WebStorageClient :
virtual void
exportPlaylistClose(Ptr::Ref token) const
throw (XmlRpcException);
+
+ /**
+ * Check the status of the asynchronous network transport operation.
+ *
+ * If the return value is
+ * - initState or pendingState, then the operation
+ * is in progress, and you need to call this function again until
+ * a different value is returned;
+ * - finishedState, then the asynchronous XML-RPC call has
+ * completed normally;
+ * - closedState, then the transport has been
+ * closed or canceled, and the token is no longer valid;
+ * - failedState, then an error has occured (and the token is
+ * no longer valid); the error message is returned in the (optional)
+ * errorMessage return parameter.
+ *
+ *
+ * @param token the transport token of an asynchronous method.
+ * @param errorMessage return parameter: if the transport has failed,
+ * this will contain the error message (optional).
+ * @return the state of the transport.
+ * @exception XmlRpcException if there is a problem with the XML-RPC
+ * call.
+ */
+ virtual TransportState
+ checkTransport(Ptr::Ref token,
+ Ptr::Ref errorMessage
+ = Ptr::Ref())
+ throw (XmlRpcException);
+
+ /**
+ * Cancel an asynchronous network transport operation.
+ *
+ * @param sessionId the session ID from the authentication client.
+ * @param token the transport token of an asynchronous method.
+ * @return the state of the transport.
+ * @exception XmlRpcException if there is a problem with the XML-RPC
+ * call.
+ */
+ virtual void
+ cancelTransport(Ptr::Ref sessionId,
+ Ptr::Ref token)
+ throw (XmlRpcException);
};
diff --git a/livesupport/src/modules/storageClient/src/WebStorageClientTest.cxx b/livesupport/src/modules/storageClient/src/WebStorageClientTest.cxx
index bfaae26f7..4f6eab10c 100644
--- a/livesupport/src/modules/storageClient/src/WebStorageClientTest.cxx
+++ b/livesupport/src/modules/storageClient/src/WebStorageClientTest.cxx
@@ -933,6 +933,10 @@ WebStorageClientTest :: remoteSearchTest(void)
);
CPPUNIT_ASSERT(token);
+ CPPUNIT_ASSERT_NO_THROW(
+ wsc->cancelTransport(sessionId, token)
+ );
+
Ptr::Ref errorMessage(new Glib::ustring);
StorageClientInterface::TransportState state;
@@ -951,7 +955,11 @@ WebStorageClientTest :: remoteSearchTest(void)
CPPUNIT_ASSERT_EQUAL(StorageClientInterface::finishedState, state);
CPPUNIT_ASSERT_NO_THROW(
- wsc->remoteSearchClose(token)
+ wsc->remoteSearchClose(token);
+ );
+
+ CPPUNIT_ASSERT_THROW(
+ wsc->cancelTransport(sessionId, token), XmlRpcMethodFaultException
);
CPPUNIT_ASSERT_NO_THROW(