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);
int webclient_get_poll_info(FAR struct webclient_context *ctx,
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);
#undef EXTERN

View File

@ -1445,9 +1445,7 @@ int webclient_perform(FAR struct webclient_context *ctx)
{
FAR struct webclient_conn_s *tunnel_conn;
ret = webclient_get_tunnel(ws->tunnel, &tunnel_conn);
if (ret == 0)
{
webclient_get_tunnel(ws->tunnel, &tunnel_conn);
DEBUGASSERT(tunnel_conn != NULL);
DEBUGASSERT(!tunnel_conn->tls);
free(ws->tunnel);
@ -1494,7 +1492,6 @@ int webclient_perform(FAR struct webclient_context *ctx)
}
}
}
}
else if (conn->tls)
{
char port_str[sizeof("65535")];
@ -2486,15 +2483,15 @@ int webclient_get_poll_info(FAR struct webclient_context *ctx,
* the tunneled connection.
*
* 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.
* The context will be invalid after the successful call of this
* function.
* The context will be invalid after a call of this 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)
{
struct wget_s *ws;
@ -2510,6 +2507,4 @@ int webclient_get_tunnel(FAR struct webclient_context *ctx,
ws->conn = NULL;
free_ws(ws);
_SET_STATE(ctx, WEBCLIENT_CONTEXT_STATE_DONE);
return 0;
}