http: notify client on request error
Notify client app that we errored out while trying to generate request. Type: fix Change-Id: I3e20fe22d8a927ae8e9bf8391297e10c974dc941 Signed-off-by: Matus Fabian <matfabia@cisco.com>
This commit is contained in:

committed by
Florin Coras

parent
1a319aadc6
commit
b8c762cc22
@ -13,11 +13,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <vnet/session/application.h>
|
|
||||||
#include <vnet/session/application_interface.h>
|
#include <vnet/session/application_interface.h>
|
||||||
#include <vnet/session/session.h>
|
#include <vnet/session/session.h>
|
||||||
#include <http/http.h>
|
#include <http/http.h>
|
||||||
#include <hs_apps/http_cli.h>
|
|
||||||
|
|
||||||
#define HCC_DEBUG 0
|
#define HCC_DEBUG 0
|
||||||
|
|
||||||
@ -68,6 +66,7 @@ typedef struct
|
|||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
HCC_REPLY_RECEIVED = 100,
|
HCC_REPLY_RECEIVED = 100,
|
||||||
|
HCC_TRANSPORT_CLOSED,
|
||||||
} hcc_cli_signal_t;
|
} hcc_cli_signal_t;
|
||||||
|
|
||||||
static hcc_main_t hcc_main;
|
static hcc_main_t hcc_main;
|
||||||
@ -273,6 +272,17 @@ hcc_ts_cleanup_callback (session_t *s, session_cleanup_ntf_t ntf)
|
|||||||
hcc_session_free (s->thread_index, hs);
|
hcc_session_free (s->thread_index, hs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
hcc_ts_transport_closed (session_t *s)
|
||||||
|
{
|
||||||
|
hcc_main_t *hcm = &hcc_main;
|
||||||
|
|
||||||
|
HCC_DBG ("transport closed");
|
||||||
|
|
||||||
|
vlib_process_signal_event_mt (hcm->vlib_main, hcm->cli_node_index,
|
||||||
|
HCC_TRANSPORT_CLOSED, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static session_cb_vft_t hcc_session_cb_vft = {
|
static session_cb_vft_t hcc_session_cb_vft = {
|
||||||
.session_accept_callback = hcc_ts_accept_callback,
|
.session_accept_callback = hcc_ts_accept_callback,
|
||||||
.session_disconnect_callback = hcc_ts_disconnect_callback,
|
.session_disconnect_callback = hcc_ts_disconnect_callback,
|
||||||
@ -281,6 +291,7 @@ static session_cb_vft_t hcc_session_cb_vft = {
|
|||||||
.builtin_app_tx_callback = hcc_ts_tx_callback,
|
.builtin_app_tx_callback = hcc_ts_tx_callback,
|
||||||
.session_reset_callback = hcc_ts_reset_callback,
|
.session_reset_callback = hcc_ts_reset_callback,
|
||||||
.session_cleanup_callback = hcc_ts_cleanup_callback,
|
.session_cleanup_callback = hcc_ts_cleanup_callback,
|
||||||
|
.session_transport_closed_callback = hcc_ts_transport_closed,
|
||||||
};
|
};
|
||||||
|
|
||||||
static clib_error_t *
|
static clib_error_t *
|
||||||
@ -411,6 +422,9 @@ hcc_run (vlib_main_t *vm, int print_output)
|
|||||||
vlib_cli_output (vm, "%v", hcm->http_response);
|
vlib_cli_output (vm, "%v", hcm->http_response);
|
||||||
vec_free (hcm->http_response);
|
vec_free (hcm->http_response);
|
||||||
break;
|
break;
|
||||||
|
case HCC_TRANSPORT_CLOSED:
|
||||||
|
err = clib_error_return (0, "error, transport closed");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
err = clib_error_return (0, "unexpected event %d", event_type);
|
err = clib_error_return (0, "unexpected event %d", event_type);
|
||||||
break;
|
break;
|
||||||
|
@ -598,7 +598,6 @@ http_state_wait_server_reply (http_conn_t *hc, transport_send_params_t *sp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
|
||||||
http_send_error (hc, ec);
|
http_send_error (hc, ec);
|
||||||
session_transport_closing_notify (&hc->connection);
|
session_transport_closing_notify (&hc->connection);
|
||||||
http_disconnect_transport (hc);
|
http_disconnect_transport (hc);
|
||||||
@ -838,7 +837,9 @@ http_state_wait_app_method (http_conn_t *hc, transport_send_params_t *sp)
|
|||||||
return HTTP_SM_STOP;
|
return HTTP_SM_STOP;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
svm_fifo_dequeue_drop_all (as->tx_fifo);
|
||||||
session_transport_closing_notify (&hc->connection);
|
session_transport_closing_notify (&hc->connection);
|
||||||
|
session_transport_closed_notify (&hc->connection);
|
||||||
http_disconnect_transport (hc);
|
http_disconnect_transport (hc);
|
||||||
return HTTP_SM_ERROR;
|
return HTTP_SM_ERROR;
|
||||||
}
|
}
|
||||||
@ -1248,7 +1249,11 @@ http_transport_close (u32 hc_index, u32 thread_index)
|
|||||||
http_disconnect_transport (hc);
|
http_disconnect_transport (hc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (hc->state == HTTP_CONN_STATE_CLOSED)
|
||||||
|
{
|
||||||
|
HTTP_DBG (1, "nothing to do, already closed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
as = session_get_from_handle (hc->h_pa_session_handle);
|
as = session_get_from_handle (hc->h_pa_session_handle);
|
||||||
|
|
||||||
/* Nothing more to send, confirm close */
|
/* Nothing more to send, confirm close */
|
||||||
|
Reference in New Issue
Block a user