summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2015-12-14 11:03:53 -0500
committerimarom <imarom@cisco.com>2015-12-14 11:05:07 -0500
commitd71dbce9695f348b2e52e00c9efd53cb89c62aa5 (patch)
treebb4727b416dac5f482545ce0e5ba9686db91b8ea /src
parent3f94a09f66657970636a532aac9411ad6a5290ad (diff)
bugs fixes
1. ignore your own force acquire of ports 2. TUI fixes
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.cpp6
-rw-r--r--src/stateless/cp/trex_stateless_port.h2
4 files changed, 9 insertions, 4 deletions
diff --git a/src/rpc-server/commands/trex_rpc_cmd_general.cpp b/src/rpc-server/commands/trex_rpc_cmd_general.cpp
index a2d4c284..a701f6db 100644
--- a/src/rpc-server/commands/trex_rpc_cmd_general.cpp
+++ b/src/rpc-server/commands/trex_rpc_cmd_general.cpp
@@ -236,12 +236,13 @@ TrexRpcCmdAcquire::_run(const Json::Value &params, Json::Value &result) {
const string &new_owner = parse_string(params, "user", result);
bool force = parse_bool(params, "force", result);
+ uint32_t session_id = parse_uint32(params, "session_id", 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, force);
+ port->acquire(new_owner, session_id, 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 c22ef390..b9be1fbe 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", 3, false);
+TREX_RPC_CMD_DEFINE(TrexRpcCmdAcquire, "acquire", 4, 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 9770c735..3a64f8c5 100644
--- a/src/stateless/cp/trex_stateless_port.cpp
+++ b/src/stateless/cp/trex_stateless_port.cpp
@@ -84,7 +84,7 @@ TrexStatelessPort::TrexStatelessPort(uint8_t port_id, const TrexPlatformApi *api
* @param force
*/
void
-TrexStatelessPort::acquire(const std::string &user, bool force) {
+TrexStatelessPort::acquire(const std::string &user, uint32_t session_id, bool force) {
/* if port is free - just take it */
if (get_owner().is_free()) {
@@ -97,7 +97,11 @@ TrexStatelessPort::acquire(const std::string &user, bool force) {
/* inform the other client of the steal... */
Json::Value data;
+
data["port_id"] = m_port_id;
+ data["who"] = user;
+ data["session_id"] = session_id;
+
get_stateless_obj()->get_publisher()->publish_event(TrexPublisher::EVENT_PORT_FORCE_ACQUIRED, data);
} else {
diff --git a/src/stateless/cp/trex_stateless_port.h b/src/stateless/cp/trex_stateless_port.h
index 4988b46a..a529d38f 100644
--- a/src/stateless/cp/trex_stateless_port.h
+++ b/src/stateless/cp/trex_stateless_port.h
@@ -138,7 +138,7 @@ public:
* acquire port
* throws TrexException in case of an error
*/
- void acquire(const std::string &user, bool force = false);
+ void acquire(const std::string &user, uint32_t session_id, bool force = false);
/**
* release the port from the current user