dpvs conn超時處理

2021-10-23 14:00:12 字數 2166 閱讀 4859

static void dp_vs_conn_attach_timer(struct dp_vs_conn *conn, bool lock)

//如果為長連線,則將定時器加入到global_timer中,否則加入至per-lcore timer中

if (dp_vs_conn_is_template(conn))

else

}else

else

}if (rc == edpvs_ok)

}

dp_vs_conn_expire

/* timeout hanlder */

static int dp_vs_conn_expire(void *priv)

/* somebody is controlled by me, expire later */

//todo:此處暫時還未看明白,好像跟什麼dp_vs_sched_persist 長連線有關

if (rte_atomic32_read(&conn->n_control))

/* unhash it then no further user can get it,

* even we cannot del it now. */

//開始清理流表,這樣後續就查詢不到了

dp_vs_conn_unhash(conn);

/* refcnt == 1 means we are the only referer.

* no one is using the conn and it's timed out. */

//引用計數為1時,

if (rte_atomic32_read(&conn->refcnt) == 1)

//如果傳輸層協議有conn_expire介面,呼叫連線超時介面,tcp中為tcp_conn_expire,主要用於在fnat模式下向兩端傳送rst包

//強制斷開連線

if (pp && pp->conn_expire)

//snat模式中清除sa_pool

dp_vs_conn_sa_release(conn);

//解綁rs之間的關係,主要減少活動連線之類的統計資訊

dp_vs_conn_unbind_dest(conn);

//釋放本地位址

dp_vs_laddr_unbind(conn);

//清理ack_mbuf,syn_mbuf等等

dp_vs_conn_free_packets(conn);

//減少連線的引用技術

rte_atomic32_dec(&conn->refcnt);

#ifdef config_dpvs_ipvs_stats_debug

conn_stats_dump("del conn", conn);

#endif

#ifdef config_dpvs_ipvs_debug

conn_dump("del conn: ", conn);

#endif

//釋放回快取池

dp_vs_conn_free(conn);

return(dtimer_stop);

}//走到這裡,說明連線還有人在用,那麼加回流表

dp_vs_conn_hash(conn);

/* some one is using it when expire,

* try del it again later */

//如果走到這裡,說明連線還有人在用,那麼更新超時時間加回定時器

dp_vs_conn_refresh_timer(conn, false);

rte_atomic32_dec(&conn->refcnt);

return(dtimer_ok);

}

tcp_conn_expire

static int tcp_conn_expire(struct dp_vs_proto *proto,

struct dp_vs_conn *conn)

err = tcp_send_rst(proto, conn, dpvs_conn_dir_outbound);

if (err != edpvs_ok)

}return(edpvs_ok);

}

C 超時處理

在網上搜尋了很多c 超時處理的方法,下面一種是我除錯過的 超時處理 public class timeoutchecker public bool wait long timeout this.dispose return flag private void dispose 呼叫超時處理方法 檢查攝...

php curl 超時處理

php curl處理請求超時 背景 寫了乙個api管理的工具,增加了api請求的的工具,某些介面請求時間比較長,某些介面時間必須要短,希望超過超時時間的請求返回其它的狀態碼,要跟失敗或者curl失敗區分開,本質上雖然都是curl失敗但是從需求角度要區分開,但是php的curl沒有類似事件的一些操作 ...

AJAX超時處理

乙個簡單的ajax類 author ichenshy gmail.com date 2010 06 04 friday param function fnbefore 使用者自定義函式 ajax開始前執行,若無則為null param function fnafter 使用者自定義函式 ajax完成...