Skip to content

Commit

Permalink
Send responses in correct order - first working version. (#419)
Browse files Browse the repository at this point in the history
  • Loading branch information
keshonok committed Oct 14, 2016
1 parent f2d5973 commit fc50aef
Show file tree
Hide file tree
Showing 10 changed files with 388 additions and 131 deletions.
14 changes: 6 additions & 8 deletions tempesta_fw/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ typedef struct {
struct list_head msg_queue;
spinlock_t msg_qlock;
atomic_t refcnt;
unsigned long flags;
struct timer_list timer;
TfwMsg *msg;
TfwPeer *peer;
Expand All @@ -102,6 +103,9 @@ typedef struct {

#define TFW_CONN_TYPE(c) ((c)->proto.type)

/* Connection flags. */
#define TFW_CONN_FWD_HOLD 0x0001 /* Hold sending messages */

/**
* TLS hardened connection.
*/
Expand Down Expand Up @@ -153,7 +157,7 @@ extern TfwConnHooks *conn_hooks[TFW_CONN_MAX_PROTOS];
tfw_conn_hook_call(TFW_CONN_TYPE2IDX(TFW_CONN_TYPE(c)), c, f)

static inline bool
tfw_connection_nfo(TfwConnection *conn)
tfw_connection_live(TfwConnection *conn)
{
return atomic_read(&conn->refcnt) > 0;
}
Expand All @@ -169,7 +173,7 @@ tfw_connection_get(TfwConnection *conn)
* process, i.e. @refcnt wasn't zero.
*/
static inline bool
tfw_connection_get_if_nfo(TfwConnection *conn)
tfw_connection_get_if_live(TfwConnection *conn)
{
int old, rc = atomic_read(&conn->refcnt);

Expand Down Expand Up @@ -277,12 +281,6 @@ tfw_connection_unlink_msg(TfwConnection *conn)
conn->msg = NULL;
}

static inline bool
tfw_connection_live(TfwConnection *conn)
{
return conn->sk && ss_sock_live(conn->sk);
}

/**
* Check that TfwConnection resources are cleaned up properly.
*/
Expand Down
Loading

0 comments on commit fc50aef

Please sign in to comment.