Skip to content

Commit

Permalink
Fixup after PR discussions
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksey Mikhaylov <[email protected]>
  • Loading branch information
ttaym committed May 5, 2022
1 parent 38a694e commit 6b4edba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion fw/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,8 @@ tfw_http_req_fwd_send(TfwSrvConn *srv_conn, TfwServer *srv, TfwHttpReq *req,
/* We set TFW_CONN_B_UNSCHED on server connection. New requests must
* not be scheduled to it. It will be used only for websocket transport.
* If upgrade will fail, we clear it. */
/* All code paths to the function guarded by `fwd_qlock` so there is
* no race condition here. */
if (test_bit(TFW_HTTP_B_UPGRADE_WEBSOCKET, req->flags)) {
set_bit(TFW_CONN_B_UNSCHED, &srv_conn->flags);
}
Expand Down Expand Up @@ -6267,7 +6269,8 @@ tfw_http_msg_process_generic(TfwConn *conn, TfwStream *stream,
if (TFW_CONN_TYPE(conn) & Conn_Clnt)
return tfw_http_req_process(conn, stream, skb);

/* That is paired request, it may be freed after resp processing */
/* That is paired request, it may be freed after resp processing,
* so we cannot move it iside `if` clause. */
req = ((TfwHttpMsg *)stream->msg)->pair;
if ((r = tfw_http_resp_process(conn, stream, skb))) {
TfwSrvConn *srv_conn = (TfwSrvConn *)conn;
Expand Down
5 changes: 3 additions & 2 deletions fw/websocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ tfw_ws_conn_alloc(void)
TfwConn *
tfw_ws_srv_new_steal_sk(TfwSrvConn *srv_conn)
{
TfwConn *conn;
TfwConn *conn = NULL;
TfwServer *srv = (TfwServer *)srv_conn->peer;

T_DBG2("%s: conn=[%p]\n", __func__, srv_conn);

if (!(conn = tfw_ws_conn_alloc())) {
T_WARN_ADDR("Can't create new connection for socket stealing",
&srv->addr, TFW_NO_PORT);
return NULL;
goto err;
}
conn->peer = (TfwPeer *)srv;
conn->sk = srv_conn->sk;
Expand All @@ -114,6 +114,7 @@ tfw_ws_srv_new_steal_sk(TfwSrvConn *srv_conn)
srv_conn->sk = NULL;
if (srv_conn->destructor)
srv_conn->destructor(srv_conn);
err:
clear_bit(TFW_CONN_B_UNSCHED, &srv_conn->flags);

return conn;
Expand Down

0 comments on commit 6b4edba

Please sign in to comment.