webclient: Make webclient_get_tunnel returns void

As it does never fail.
This commit is contained in:
YAMAMOTO Takashi 2022-06-17 15:03:46 +09:00 committed by Xiang Xiao
parent 5cfc5cd4f2
commit fca5b186b1
2 changed files with 42 additions and 47 deletions

View File

@ -561,7 +561,7 @@ void webclient_set_static_body(FAR struct webclient_context *ctx,
size_t bodylen); size_t bodylen);
int webclient_get_poll_info(FAR struct webclient_context *ctx, int webclient_get_poll_info(FAR struct webclient_context *ctx,
FAR struct webclient_poll_info *info); FAR struct webclient_poll_info *info);
int webclient_get_tunnel(FAR struct webclient_context *ctx, void webclient_get_tunnel(FAR struct webclient_context *ctx,
FAR struct webclient_conn_s **connp); FAR struct webclient_conn_s **connp);
#undef EXTERN #undef EXTERN

View File

@ -1445,9 +1445,7 @@ int webclient_perform(FAR struct webclient_context *ctx)
{ {
FAR struct webclient_conn_s *tunnel_conn; FAR struct webclient_conn_s *tunnel_conn;
ret = webclient_get_tunnel(ws->tunnel, &tunnel_conn); webclient_get_tunnel(ws->tunnel, &tunnel_conn);
if (ret == 0)
{
DEBUGASSERT(tunnel_conn != NULL); DEBUGASSERT(tunnel_conn != NULL);
DEBUGASSERT(!tunnel_conn->tls); DEBUGASSERT(!tunnel_conn->tls);
free(ws->tunnel); free(ws->tunnel);
@ -1494,7 +1492,6 @@ int webclient_perform(FAR struct webclient_context *ctx)
} }
} }
} }
}
else if (conn->tls) else if (conn->tls)
{ {
char port_str[sizeof("65535")]; char port_str[sizeof("65535")];
@ -2486,15 +2483,15 @@ int webclient_get_poll_info(FAR struct webclient_context *ctx,
* the tunneled connection. * the tunneled connection.
* *
* This function should be used exactly once after a successful * This function should be used exactly once after a successful
* call of webclient_perform with WEBCLIENT_FLAG_TUNNEL. * call of webclient_perform with WEBCLIENT_FLAG_TUNNEL, with
* http_status 2xx.
* *
* This function also disposes the given webclient_context. * This function also disposes the given webclient_context.
* The context will be invalid after the successful call of this * The context will be invalid after a call of this function.
* function.
* *
****************************************************************************/ ****************************************************************************/
int webclient_get_tunnel(FAR struct webclient_context *ctx, void webclient_get_tunnel(FAR struct webclient_context *ctx,
FAR struct webclient_conn_s **connp) FAR struct webclient_conn_s **connp)
{ {
struct wget_s *ws; struct wget_s *ws;
@ -2510,6 +2507,4 @@ int webclient_get_tunnel(FAR struct webclient_context *ctx,
ws->conn = NULL; ws->conn = NULL;
free_ws(ws); free_ws(ws);
_SET_STATE(ctx, WEBCLIENT_CONTEXT_STATE_DONE); _SET_STATE(ctx, WEBCLIENT_CONTEXT_STATE_DONE);
return 0;
} }