mirror of
https://github.com/Netflix/dial-reference.git
synced 2026-06-08 02:49:58 +00:00
jira SDK-5322: DIAL client that supports 2.1 and higher SHOULD include a clientDialVer query parameter while querying application status
This commit is contained in:
@@ -68,6 +68,10 @@ int DialServer::sendCommand(
|
||||
CURLcode res = CURLE_OK;
|
||||
struct curl_slist *slist = NULL;
|
||||
|
||||
// since we are Dial Version 2.1, added query paramter to indicate Dial Version
|
||||
url += "?clientDialVer=";
|
||||
url += CLIENT_VERSION;
|
||||
|
||||
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
|
||||
{
|
||||
fprintf(stderr, "curl_global_init() failed\n");
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define CLIENT_VERSION "2.1"
|
||||
|
||||
class DialServer
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -183,6 +183,13 @@ static void handle_app_status(struct mg_connection *conn,
|
||||
int canStop = 0;
|
||||
DIALServer *ds = request_info->user_data;
|
||||
|
||||
// determin client version
|
||||
char *clientVersionStr = parse_param(request_info->query_string, "clientDialVer");
|
||||
double clientVersion = 0.0;
|
||||
if (clientVersionStr){
|
||||
clientVersion = atof(clientVersionStr);
|
||||
}
|
||||
|
||||
ds_lock(ds);
|
||||
app = *find_app(ds, app_name);
|
||||
if (!app) {
|
||||
@@ -217,8 +224,16 @@ static void handle_app_status(struct mg_connection *conn,
|
||||
|
||||
app->state = app->callbacks.status_cb(ds, app_name, app->run_id, &canStop,
|
||||
app->callback_data);
|
||||
|
||||
DIALStatus localState = app->state;
|
||||
|
||||
// overwrite app->state if cilent version < 2.1
|
||||
if (clientVersion < 2.09 && localState==kDIALStatusHide){
|
||||
localState=kDIALStatusStopped;
|
||||
}
|
||||
|
||||
char dial_state_str[20];
|
||||
switch(app->state){
|
||||
switch(localState){
|
||||
case kDIALStatusHide:
|
||||
strcpy (dial_state_str, "hidden");
|
||||
break;
|
||||
@@ -250,7 +265,7 @@ static void handle_app_status(struct mg_connection *conn,
|
||||
app->name,
|
||||
canStop ? "true" : "false",
|
||||
dial_state_str,
|
||||
app->state == kDIALStatusStopped ?
|
||||
localState == kDIALStatusStopped ?
|
||||
"" : " <link rel=\"run\" href=\"run\"/>\r\n",
|
||||
dial_data);
|
||||
ds_unlock(ds);
|
||||
|
||||
Reference in New Issue
Block a user