Skip to content

Commit

Permalink
Rename TfwConnection{} to TfwConn{}.
Browse files Browse the repository at this point in the history
Also, rename:
TfwCliConnection{} to TfwCliConn{}
TfwSrvConnection{} to TfwSrvConn{}
  • Loading branch information
keshonok committed Jan 27, 2017
1 parent f09d484 commit 505f1b6
Show file tree
Hide file tree
Showing 24 changed files with 302 additions and 312 deletions.
24 changes: 12 additions & 12 deletions tempesta_fw/classifier/frang.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ frang_conn_limit(FrangAcc *ra, struct sock *unused)
}

/*
* Increment connection counters even if we return TFW_BLOCK.
* Linux will call sk_free() from inet_csk_clone_lock(),
* so our frang_conn_close() is also called. conn_curr is
* decremented there, but conn_new is not changed. We count
* both failed connection attempts and connections that were
* successfully established.
* Increment connection counters even when we return TFW_BLOCK.
* Linux will call sk_free() from inet_csk_clone_lock(), so our
* frang_conn_close() is also called. @conn_curr is decremented
* there, but @conn_new is not changed. We count both failed
* connection attempts and connections that were successfully
* established.
*/
ra->history[i].conn_new++;
ra->conn_curr++;
Expand Down Expand Up @@ -219,14 +219,14 @@ frang_conn_new(struct sock *sk)
spin_lock(&ra->lock);

/*
* sk->sk_user_data references TfwConnection which in turn references
* TfwPeer, so basically we can get FrangAcc from TfwConnection.
* sk->sk_user_data references TfwConn{} which in turn references
* TfwPeer, so basically we can get FrangAcc from TfwConn{}.
* However, socket can live (for a short period of time, when kernel
* just allocated the socket and called tempesta_new_clntsk()) w/o
* TfwConnection and vise versa - TfwConnection can leave w/o socket
* TfwConn{} and vise versa - TfwConn{} can leave w/o socket
* (e.g. server connections during failover). Thus to keep design
* consistent we two references to TfwPeer: from socket and
* TfwConnection.
* TfwConn{}.
*/
sk->sk_security = ra;

Expand Down Expand Up @@ -601,7 +601,7 @@ do { \
} while (0)

static int
frang_http_req_process(FrangAcc *ra, TfwConnection *conn, struct sk_buff *skb,
frang_http_req_process(FrangAcc *ra, TfwConn *conn, struct sk_buff *skb,
unsigned int off)
{
int r = TFW_PASS;
Expand Down Expand Up @@ -848,7 +848,7 @@ static int
frang_http_req_handler(void *obj, struct sk_buff *skb, unsigned int off)
{
int r;
TfwConnection *conn = (TfwConnection *)obj;
TfwConn *conn = (TfwConn *)obj;
FrangAcc *ra = conn->sk->sk_security;

r = frang_http_req_process(ra, conn, skb, off);
Expand Down
4 changes: 2 additions & 2 deletions tempesta_fw/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ typedef struct {

TfwClient *tfw_client_obtain(struct sock *sk, void (*init)(TfwClient *));
void tfw_client_put(TfwClient *cli);
void tfw_cli_conn_release(TfwCliConnection *cli_conn);
int tfw_cli_conn_send(TfwCliConnection *cli_conn, TfwMsg *msg);
void tfw_cli_conn_release(TfwCliConn *cli_conn);
int tfw_cli_conn_send(TfwCliConn *cli_conn, TfwMsg *msg);
int tfw_sock_check_listeners(void);

#endif /* __TFW_CLIENT_H__ */
18 changes: 9 additions & 9 deletions tempesta_fw/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ TfwConnHooks *conn_hooks[TFW_CONN_MAX_PROTOS];
* It's not on any list yet, so it's safe to do so without locks.
*/
void
tfw_connection_init(TfwConnection *conn)
tfw_connection_init(TfwConn *conn)
{
memset(conn, 0, sizeof(*conn));
INIT_LIST_HEAD(&conn->list);
}

void
tfw_connection_link_peer(TfwConnection *conn, TfwPeer *peer)
tfw_connection_link_peer(TfwConn *conn, TfwPeer *peer)
{
BUG_ON(conn->peer || !list_empty(&conn->list));
conn->peer = peer;
Expand All @@ -50,7 +50,7 @@ tfw_connection_link_peer(TfwConnection *conn, TfwPeer *peer)
* Publish the "connection is established" event via TfwConnHooks.
*/
int
tfw_connection_new(TfwConnection *conn)
tfw_connection_new(TfwConn *conn)
{
return TFW_CONN_HOOK_CALL(conn, conn_init);
}
Expand All @@ -59,7 +59,7 @@ tfw_connection_new(TfwConnection *conn)
* Call connection repairing via TfwConnHooks.
*/
void
tfw_connection_repair(TfwConnection *conn)
tfw_connection_repair(TfwConn *conn)
{
TFW_CONN_HOOK_CALL(conn, conn_repair);
}
Expand All @@ -68,7 +68,7 @@ tfw_connection_repair(TfwConnection *conn)
* Publish the "connection is dropped" event via TfwConnHooks.
*/
void
tfw_connection_drop(TfwConnection *conn)
tfw_connection_drop(TfwConn *conn)
{
/* Ask higher levels to free resources at connection close. */
TFW_CONN_HOOK_CALL(conn, conn_drop);
Expand All @@ -79,12 +79,12 @@ tfw_connection_drop(TfwConnection *conn)
* Publish the "connection is released" event via TfwConnHooks.
*/
void
tfw_connection_release(TfwConnection *conn)
tfw_connection_release(TfwConn *conn)
{
/* Ask higher levels to free resources at connection release. */
TFW_CONN_HOOK_CALL(conn, conn_release);
BUG_ON((TFW_CONN_TYPE(conn) & Conn_Clnt)
&& !list_empty(&((TfwCliConnection *)conn)->seq_queue));
&& !list_empty(&((TfwCliConn *)conn)->seq_queue));
}

/*
Expand All @@ -94,15 +94,15 @@ tfw_connection_release(TfwConnection *conn)
* only on an active socket.
*/
int
tfw_connection_send(TfwConnection *conn, TfwMsg *msg)
tfw_connection_send(TfwConn *conn, TfwMsg *msg)
{
return TFW_CONN_HOOK_CALL(conn, conn_send, msg);
}

int
tfw_connection_recv(void *cdata, struct sk_buff *skb, unsigned int off)
{
TfwConnection *conn = cdata;
TfwConn *conn = cdata;

return tfw_gfsm_dispatch(&conn->state, conn, skb, off);
}
Expand Down
Loading

0 comments on commit 505f1b6

Please sign in to comment.