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

Function ng_pptpgre_reset

freebsd/netgraph/ng_pptpgre.c:1234–1271  ·  view source on GitHub ↗

* Reset state (must be called with lock held or from writer) */

Source from the content-addressed store, hash-verified

1232 * Reset state (must be called with lock held or from writer)
1233 */
1234static void
1235ng_pptpgre_reset(hpriv_p hpriv)
1236{
1237 struct ng_pptpgre_roq *np;
1238
1239 /* Reset adaptive timeout state */
1240 hpriv->ato = PPTP_MAX_TIMEOUT;
1241 hpriv->rtt = PPTP_TIME_SCALE / 10;
1242 if (hpriv->conf.peerPpd > 1) /* ppd = 0 treat as = 1 */
1243 hpriv->rtt *= hpriv->conf.peerPpd;
1244 hpriv->dev = 0;
1245 hpriv->xmitWin = (hpriv->conf.recvWin + 1) / 2;
1246 if (hpriv->xmitWin < 2) /* often the first packet is lost */
1247 hpriv->xmitWin = 2; /* because the peer isn't ready */
1248 else if (hpriv->xmitWin > PPTP_XMIT_WIN)
1249 hpriv->xmitWin = PPTP_XMIT_WIN;
1250 hpriv->winAck = hpriv->xmitWin;
1251
1252 /* Reset sequence numbers */
1253 hpriv->recvSeq = ~0;
1254 hpriv->recvAck = ~0;
1255 hpriv->xmitSeq = ~0;
1256 hpriv->xmitAck = ~0;
1257
1258 /* Stop timers */
1259 ng_uncallout(&hpriv->sackTimer, hpriv->node);
1260 ng_uncallout(&hpriv->rackTimer, hpriv->node);
1261 ng_uncallout(&hpriv->reorderTimer, hpriv->node);
1262
1263 /* Clear reorder queue */
1264 while (!SLIST_EMPTY(&hpriv->roq)) {
1265 np = SLIST_FIRST(&hpriv->roq);
1266 SLIST_REMOVE_HEAD(&hpriv->roq, next);
1267 NG_FREE_ITEM(np->item);
1268 free(np, M_NETGRAPH);
1269 }
1270 hpriv->roq_len = 0;
1271}
1272
1273/*
1274 * Return the current time scaled & translated to our internally used format.

Callers 3

ng_pptpgre_rcvmsgFunction · 0.85
ng_pptpgre_disconnectFunction · 0.85
ng_pptpgre_shutdownFunction · 0.85

Calls 2

ng_uncalloutFunction · 0.70
freeFunction · 0.50

Tested by

no test coverage detected