Commit 46b43f4e authored by Pekka Ervasti's avatar Pekka Ervasti Committed by Pekka Niemimaa
Browse files

ts_engine/connectors: pass negative error code to process function


Signed-off-by: default avatarPekka Ervasti <pekka.ervasti@haltian.com>
parent 6f3bed5a
......@@ -251,18 +251,24 @@ static int execute_task_conn_request(struct conn_network_task_s *task)
if (ret == OK)
{
int status_code;
int status_code = INT_MIN;
char *content = NULL;
ret = execute_http_request(&con->srv_ip4addr, con->port,
hdr, hdrlen, data, datalen, &status_code, &content,
task->context);
if (ret == OK)
if (ret < 0)
{
status_code = ret;
}
if (status_code != INT_MIN)
{
next_task = task->process(task->context, status_code, content);
if (next_task != NULL)
ret = conn_network_give_new_conn_task(next_task);
}
conn_free_pointer((void**)&content);
conn_free_pointer((void**)&hdr);
}
......@@ -322,6 +328,9 @@ static void *conn_network_thread(void *param)
if (ret < 0)
{
con_dbg("request_connection on failed, skipping task\n");
task.conn->process(task.conn->context, NETWORK_ERROR, NULL);
conn_complete_task_workflow(task.conn->context, ret);
conn_destroy_task(task.conn);
break;
}
......
......@@ -251,18 +251,24 @@ static int execute_task_conn_request(struct conn_network_task_s *task)
if (ret == OK)
{
int status_code;
int status_code = INT_MIN;
char *content = NULL;
ret = execute_http_request(&con->srv_ip4addr, con->port,
hdr, hdrlen, data, datalen, &status_code, &content,
task->context);
if (ret == OK)
if (ret < 0)
{
status_code = ret;
}
if (status_code != INT_MIN)
{
next_task = task->process(task->context, status_code, content);
if (next_task != NULL)
ret = conn_network_give_new_conn_task(next_task);
}
conn_free_pointer((void**)&content);
conn_free_pointer((void**)&hdr);
}
......@@ -322,6 +328,9 @@ static void *conn_network_thread(void *param)
if (ret < 0)
{
con_dbg("request_connection on failed, skipping task\n");
task.conn->process(task.conn->context, NETWORK_ERROR, NULL);
conn_complete_task_workflow(task.conn->context, ret);
conn_destroy_task(task.conn);
break;
}
......
......@@ -251,18 +251,24 @@ static int execute_task_conn_request(struct conn_network_task_s *task)
if (ret == OK)
{
int status_code;
int status_code = INT_MIN;
char *content = NULL;
ret = execute_http_request(&con->srv_ip4addr, con->port,
hdr, hdrlen, data, datalen, &status_code, &content,
task->context);
if (ret == OK)
if (ret < 0)
{
status_code = ret;
}
if (status_code != INT_MIN)
{
next_task = task->process(task->context, status_code, content);
if (next_task != NULL)
ret = conn_network_give_new_conn_task(next_task);
}
conn_free_pointer((void**)&content);
conn_free_pointer((void**)&hdr);
}
......@@ -322,6 +328,9 @@ static void *conn_network_thread(void *param)
if (ret < 0)
{
con_dbg("request_connection on failed, skipping task\n");
task.conn->process(task.conn->context, NETWORK_ERROR, NULL);
conn_complete_task_workflow(task.conn->context, ret);
conn_destroy_task(task.conn);
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment