summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rpc-server/commands/trex_rpc_cmd_general.cpp3
-rw-r--r--src/rpc-server/commands/trex_rpc_cmds.h2
-rw-r--r--src/stateless/cp/trex_stateless_port.cpp12
-rw-r--r--src/stateless/cp/trex_stateless_port.h11
4 files changed, 8 insertions, 20 deletions
diff --git a/src/rpc-server/commands/trex_rpc_cmd_general.cpp b/src/rpc-server/commands/trex_rpc_cmd_general.cpp
index 6c239bf3..a2d4c284 100644
--- a/src/rpc-server/commands/trex_rpc_cmd_general.cpp
+++ b/src/rpc-server/commands/trex_rpc_cmd_general.cpp
@@ -235,14 +235,13 @@ TrexRpcCmdAcquire::_run(const Json::Value &params, Json::Value &result) {
uint8_t port_id = parse_port(params, result);
const string &new_owner = parse_string(params, "user", result);
- uint32_t session_id = parse_uint32(params, "session_id", result);
bool force = parse_bool(params, "force", result);
/* if not free and not you and not force - fail */
TrexStatelessPort *port = get_stateless_obj()->get_port_by_id(port_id);
try {
- port->acquire(new_owner, session_id, force);
+ port->acquire(new_owner, force);
} catch (const TrexRpcException &ex) {
generate_execute_err(result, ex.what());
}
diff --git a/src/rpc-server/commands/trex_rpc_cmds.h b/src/rpc-server/commands/trex_rpc_cmds.h
index b9be1fbe..c22ef390 100644
--- a/src/rpc-server/commands/trex_rpc_cmds.h
+++ b/src/rpc-server/commands/trex_rpc_cmds.h
@@ -70,7 +70,7 @@ void get_hostname(std::string &hostname);
* ownership
*/
TREX_RPC_CMD_DEFINE(TrexRpcCmdGetOwner, "get_owner", 1, false);
-TREX_RPC_CMD_DEFINE(TrexRpcCmdAcquire, "acquire", 4, false);
+TREX_RPC_CMD_DEFINE(TrexRpcCmdAcquire, "acquire", 3, false);
TREX_RPC_CMD_DEFINE(TrexRpcCmdRelease, "release", 1, true);
diff --git a/src/stateless/cp/trex_stateless_port.cpp b/src/stateless/cp/trex_stateless_port.cpp
index 96194321..9770c735 100644
--- a/src/stateless/cp/trex_stateless_port.cpp
+++ b/src/stateless/cp/trex_stateless_port.cpp
@@ -84,22 +84,16 @@ TrexStatelessPort::TrexStatelessPort(uint8_t port_id, const TrexPlatformApi *api
* @param force
*/
void
-TrexStatelessPort::acquire(const std::string &user, uint32_t session_id, bool force) {
+TrexStatelessPort::acquire(const std::string &user, bool force) {
/* if port is free - just take it */
if (get_owner().is_free()) {
- get_owner().own(user, session_id);
+ get_owner().own(user);
return;
}
- /* not free - but it might be the same user that owns the port */
- if ( (get_owner().get_name() == user) && (get_owner().get_session_id() == session_id) ) {
- return;
- }
-
- /* so different session id or different user */
if (force) {
- get_owner().own(user, session_id);
+ get_owner().own(user);
/* inform the other client of the steal... */
Json::Value data;
diff --git a/src/stateless/cp/trex_stateless_port.h b/src/stateless/cp/trex_stateless_port.h
index 1310fdb2..4988b46a 100644
--- a/src/stateless/cp/trex_stateless_port.h
+++ b/src/stateless/cp/trex_stateless_port.h
@@ -58,11 +58,10 @@ public:
return ( !m_is_free && (m_owner_name == user) );
}
- void own(const std::string &owner_name, uint32_t session_id) {
+ void own(const std::string &owner_name) {
/* save user data */
m_owner_name = owner_name;
- m_session_id = session_id;
/* internal data */
m_handler = generate_handler();
@@ -81,9 +80,6 @@ public:
return (!m_is_free ? m_handler : g_unowned_handler);
}
- uint32_t get_session_id() {
- return m_session_id;
- }
private:
std::string generate_handler();
@@ -91,9 +87,8 @@ private:
/* is this port owned by someone ? */
bool m_is_free;
- /* user provided info - name and session id */
+ /* user provided info */
std::string m_owner_name;
- uint32_t m_session_id;
/* handler genereated internally */
std::string m_handler;
@@ -143,7 +138,7 @@ public:
* acquire port
* throws TrexException in case of an error
*/
- void acquire(const std::string &user, uint32_t session_id, bool force = false);
+ void acquire(const std::string &user, bool force = false);
/**
* release the port from the current user