MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sctp_timer_start

Function sctp_timer_start

freebsd/netinet/sctputil.c:2141–2568  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2139 */
2140
2141void
2142sctp_timer_start(int t_type, struct sctp_inpcb *inp, struct sctp_tcb *stcb,
2143 struct sctp_nets *net)
2144{
2145 struct sctp_timer *tmr;
2146 uint32_t to_ticks;
2147 uint32_t rndval, jitter;
2148
2149 KASSERT(stcb == NULL || stcb->sctp_ep == inp,
2150 ("sctp_timer_start of type %d: inp = %p, stcb->sctp_ep %p",
2151 t_type, stcb, stcb->sctp_ep));
2152 tmr = NULL;
2153 if (stcb != NULL) {
2154 SCTP_TCB_LOCK_ASSERT(stcb);
2155 } else if (inp != NULL) {
2156 SCTP_INP_WLOCK_ASSERT(inp);
2157 } else {
2158 SCTP_WQ_ADDR_LOCK_ASSERT();
2159 }
2160 if (stcb != NULL) {
2161 /*
2162 * Don't restart timer on association that's about to be
2163 * killed.
2164 */
2165 if ((stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) &&
2166 (t_type != SCTP_TIMER_TYPE_ASOCKILL)) {
2167 SCTPDBG(SCTP_DEBUG_TIMER2,
2168 "Timer type %d not started: inp=%p, stcb=%p, net=%p (stcb deleted).\n",
2169 t_type, inp, stcb, net);
2170 return;
2171 }
2172 /* Don't restart timer on net that's been removed. */
2173 if (net != NULL && (net->dest_state & SCTP_ADDR_BEING_DELETED)) {
2174 SCTPDBG(SCTP_DEBUG_TIMER2,
2175 "Timer type %d not started: inp=%p, stcb=%p, net=%p (net deleted).\n",
2176 t_type, inp, stcb, net);
2177 return;
2178 }
2179 }
2180 switch (t_type) {
2181 case SCTP_TIMER_TYPE_SEND:
2182 /* Here we use the RTO timer. */
2183 if ((inp == NULL) || (stcb == NULL) || (net == NULL)) {
2184#ifdef INVARIANTS
2185 panic("sctp_timer_start of type %d: inp = %p, stcb = %p, net = %p",
2186 t_type, inp, stcb, net);
2187#else
2188 return;
2189#endif
2190 }
2191 tmr = &net->rxt_timer;
2192 if (net->RTO == 0) {
2193 to_ticks = sctp_msecs_to_ticks(stcb->asoc.initial_rto);
2194 } else {
2195 to_ticks = sctp_msecs_to_ticks(net->RTO);
2196 }
2197 break;
2198 case SCTP_TIMER_TYPE_INIT:

Callers 15

sctp_send_initiateFunction · 0.85
sctp_sendall_iteratorFunction · 0.85
sctp_med_chunk_outputFunction · 0.85
sctp_timer_validationFunction · 0.85
sctp_send_sackFunction · 0.85
sctp_send_str_reset_reqFunction · 0.85
sctp_lower_sosendFunction · 0.85
sctp_start_net_timersFunction · 0.85
sctp_handle_shutdownFunction · 0.85

Calls 3

sctp_msecs_to_ticksFunction · 0.85
sctp_select_initial_TSNFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected