mirror of
https://github.com/Netflix/dial-reference.git
synced 2026-06-11 03:49:57 +00:00
increased the ipc buffer and fixed the curl post size
This commit is contained in:
@@ -86,6 +86,9 @@ int DialServer::sendCommand(
|
|||||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, payload.size());
|
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, payload.size());
|
||||||
if( payload.size() )
|
if( payload.size() )
|
||||||
{
|
{
|
||||||
|
struct curl_slist *slist=NULL;
|
||||||
|
slist = curl_slist_append(slist, "Expect:");
|
||||||
|
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
|
||||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload.c_str());
|
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload.c_str());
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
#include "mq_ipc.h"
|
#include "mq_ipc.h"
|
||||||
|
|
||||||
#define PMODE 0655
|
#define PMODE 0655
|
||||||
|
#define IPC_MAX_MSG_SIZE 5*1024 // Account for 4kb DIAL payload
|
||||||
|
#define IPC_MAX_MSG_COUNT 1
|
||||||
|
|
||||||
static mqd_t mClientServer=-1;
|
static mqd_t mClientServer=-1;
|
||||||
static mqd_t mServerClient=-1;
|
static mqd_t mServerClient=-1;
|
||||||
@@ -14,8 +16,8 @@ static mqd_t mServerClient=-1;
|
|||||||
int createMessageQ(const char* fd, int flags)
|
int createMessageQ(const char* fd, int flags)
|
||||||
{
|
{
|
||||||
struct mq_attr attr;
|
struct mq_attr attr;
|
||||||
attr.mq_maxmsg = 10;
|
attr.mq_maxmsg = IPC_MAX_MSG_SIZE;
|
||||||
attr.mq_msgsize = 512;
|
attr.mq_msgsize = IPC_MAX_MSG_COUNT;
|
||||||
|
|
||||||
mqd_t handle = mq_open(fd, flags, PMODE, &attr);
|
mqd_t handle = mq_open(fd, flags, PMODE, &attr);
|
||||||
if (handle == -1) {
|
if (handle == -1) {
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
#include "jsmn.h"
|
#include "jsmn.h"
|
||||||
#include "url_lib.h"
|
#include "url_lib.h"
|
||||||
|
|
||||||
|
#define IPC_BUF_SIZE 5*1024 // account for 4kb payload
|
||||||
|
#define IPC_TIMEOUT 2
|
||||||
|
|
||||||
static char *defaultLaunchParam = "source_type=12";
|
static char *defaultLaunchParam = "source_type=12";
|
||||||
static char * mq_send_ch = "/fromAppManager";
|
static char * mq_send_ch = "/fromAppManager";
|
||||||
static char * mq_receive_ch = "/toAppManager";
|
static char * mq_receive_ch = "/toAppManager";
|
||||||
@@ -77,13 +80,13 @@ DIALStatus get_nf_state()
|
|||||||
if (mq_ipc_connect(mq_send_ch, mq_receive_ch))
|
if (mq_ipc_connect(mq_send_ch, mq_receive_ch))
|
||||||
exit(1);
|
exit(1);
|
||||||
//send status request
|
//send status request
|
||||||
char tx_buf[64];
|
char tx_buf[IPC_BUF_SIZE];
|
||||||
snprintf(tx_buf, 64, mq_tx_msg_base, "", CMD_CNT_GET_STATUS);
|
snprintf(tx_buf, sizeof(tx_buf), mq_tx_msg_base, "", CMD_CNT_GET_STATUS);
|
||||||
if (mq_ipc_send_timed(tx_buf, 2))
|
if (mq_ipc_send_timed(tx_buf, IPC_TIMEOUT))
|
||||||
errorMsg();
|
errorMsg();
|
||||||
//recieve status
|
//recieve status
|
||||||
char rx_buf[512];
|
char rx_buf[IPC_BUF_SIZE];
|
||||||
if(mq_ipc_receive_timed(rx_buf, 512, 2))
|
if(mq_ipc_receive_timed(rx_buf, sizeof(rx_buf), IPC_TIMEOUT))
|
||||||
errorMsg();
|
errorMsg();
|
||||||
ATRACE("recieved: \n %s\n", rx_buf);
|
ATRACE("recieved: \n %s\n", rx_buf);
|
||||||
|
|
||||||
@@ -151,8 +154,8 @@ DIALStatus am_netflix_start(DIALServer *ds, const char *appname,
|
|||||||
|
|
||||||
ATRACE ("start netflix via app manager..\n");
|
ATRACE ("start netflix via app manager..\n");
|
||||||
|
|
||||||
char tx_buf[512];
|
char tx_buf[IPC_BUF_SIZE];
|
||||||
char rx_buf[512];
|
char rx_buf[IPC_BUF_SIZE];
|
||||||
mq_ipc_connect(mq_send_ch, mq_receive_ch);
|
mq_ipc_connect(mq_send_ch, mq_receive_ch);
|
||||||
|
|
||||||
char sQueryParam[DIAL_MAX_PAYLOAD+DIAL_MAX_ADDITIONALURL+40];
|
char sQueryParam[DIAL_MAX_PAYLOAD+DIAL_MAX_ADDITIONALURL+40];
|
||||||
@@ -176,22 +179,22 @@ DIALStatus am_netflix_start(DIALServer *ds, const char *appname,
|
|||||||
switch (current_state) {
|
switch (current_state) {
|
||||||
case kDIALStatusHide:
|
case kDIALStatusHide:
|
||||||
// resume Netflix
|
// resume Netflix
|
||||||
snprintf(tx_buf, 512, mq_tx_msg_base, sQueryParam, CMD_CNT_START_FROM_HIDE);
|
snprintf(tx_buf, sizeof(tx_buf), mq_tx_msg_base, sQueryParam, CMD_CNT_START_FROM_HIDE);
|
||||||
break;
|
break;
|
||||||
case kDIALStatusStopped:
|
case kDIALStatusStopped:
|
||||||
// start Netflix
|
// start Netflix
|
||||||
s_run_id++;
|
s_run_id++;
|
||||||
snprintf(tx_buf, 512, mq_tx_msg_base, sQueryParam, CMD_CNT_START);
|
snprintf(tx_buf, sizeof(tx_buf), mq_tx_msg_base, sQueryParam, CMD_CNT_START);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Already running. Just get status
|
// Already running. Just get status
|
||||||
snprintf(tx_buf, 512, mq_tx_msg_base, "", CMD_CNT_GET_STATUS);
|
snprintf(tx_buf, sizeof(tx_buf), mq_tx_msg_base, "", CMD_CNT_GET_STATUS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mq_ipc_send_timed(tx_buf, 2))
|
if (mq_ipc_send_timed(tx_buf, IPC_TIMEOUT))
|
||||||
errorMsg();
|
errorMsg();
|
||||||
if (mq_ipc_receive_timed(rx_buf, 512, 2))
|
if (mq_ipc_receive_timed(rx_buf, sizeof(rx_buf), IPC_TIMEOUT))
|
||||||
errorMsg();
|
errorMsg();
|
||||||
ATRACE("recieved: \n %s\n", rx_buf);
|
ATRACE("recieved: \n %s\n", rx_buf);
|
||||||
|
|
||||||
@@ -207,13 +210,13 @@ DIALStatus am_netflix_hide(DIALServer *ds, const char *app_name,
|
|||||||
if (mq_ipc_connect(mq_send_ch, mq_receive_ch))
|
if (mq_ipc_connect(mq_send_ch, mq_receive_ch))
|
||||||
exit(1);
|
exit(1);
|
||||||
//send status request
|
//send status request
|
||||||
char tx_buf[64];
|
char tx_buf[IPC_BUF_SIZE];
|
||||||
snprintf(tx_buf, 64, mq_tx_msg_base, "", CMD_CNT_HIDE);
|
snprintf(tx_buf, sizeof(tx_buf), mq_tx_msg_base, "", CMD_CNT_HIDE);
|
||||||
if (mq_ipc_send_timed(tx_buf, 2))
|
if (mq_ipc_send_timed(tx_buf, IPC_TIMEOUT))
|
||||||
errorMsg();
|
errorMsg();
|
||||||
//recieve status
|
//recieve status
|
||||||
char rx_buf[512];
|
char rx_buf[IPC_BUF_SIZE];
|
||||||
if(mq_ipc_receive_timed(rx_buf, 512, 2))
|
if(mq_ipc_receive_timed(rx_buf, sizeof(rx_buf), IPC_TIMEOUT))
|
||||||
errorMsg();
|
errorMsg();
|
||||||
ATRACE("recieved: \n %s\n", rx_buf);
|
ATRACE("recieved: \n %s\n", rx_buf);
|
||||||
mq_ipc_disconnect();
|
mq_ipc_disconnect();
|
||||||
@@ -234,13 +237,13 @@ void am_netflix_stop(DIALServer *ds, const char *appname, DIAL_run_t run_id,
|
|||||||
if (mq_ipc_connect(mq_send_ch, mq_receive_ch))
|
if (mq_ipc_connect(mq_send_ch, mq_receive_ch))
|
||||||
exit(1);
|
exit(1);
|
||||||
//send status request
|
//send status request
|
||||||
char tx_buf[64];
|
char tx_buf[IPC_BUF_SIZE];
|
||||||
snprintf(tx_buf, 64, mq_tx_msg_base, "", CMD_CNT_STOP);
|
snprintf(tx_buf, sizeof(tx_buf), mq_tx_msg_base, "", CMD_CNT_STOP);
|
||||||
if (mq_ipc_send_timed(tx_buf, 2))
|
if (mq_ipc_send_timed(tx_buf, IPC_TIMEOUT))
|
||||||
errorMsg();
|
errorMsg();
|
||||||
//recieve status
|
//recieve status
|
||||||
char rx_buf[512];
|
char rx_buf[IPC_BUF_SIZE];
|
||||||
if(mq_ipc_receive_timed(rx_buf, 512, 2))
|
if(mq_ipc_receive_timed(rx_buf, sizeof(rx_buf), IPC_TIMEOUT))
|
||||||
errorMsg();
|
errorMsg();
|
||||||
ATRACE("recieved: \n %s\n", rx_buf);
|
ATRACE("recieved: \n %s\n", rx_buf);
|
||||||
mq_ipc_disconnect();
|
mq_ipc_disconnect();
|
||||||
|
|||||||
Reference in New Issue
Block a user