提交 aa13cb0a authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Update NPM deps and usrsctp

上级 a5880a52
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
"testRegex": "test/test.*\\.js" "testRegex": "test/test.*\\.js"
}, },
"dependencies": { "dependencies": {
"@types/node": "^14.14.28", "@types/node": "^14.14.33",
"awaitqueue": "^2.3.3", "awaitqueue": "^2.3.3",
"debug": "^4.3.1", "debug": "^4.3.1",
"h264-profile-level-id": "^1.0.1", "h264-profile-level-id": "^1.0.1",
...@@ -60,11 +60,11 @@ ...@@ -60,11 +60,11 @@
"@types/debug": "^4.1.5", "@types/debug": "^4.1.5",
"@types/random-number": "0.0.0", "@types/random-number": "0.0.0",
"@types/uuid": "^8.3.0", "@types/uuid": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^4.15.0", "@typescript-eslint/eslint-plugin": "^4.17.0",
"@typescript-eslint/parser": "^4.15.0", "@typescript-eslint/parser": "^4.17.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"eslint": "^7.20.0", "eslint": "^7.21.0",
"eslint-plugin-jest": "^24.1.3", "eslint-plugin-jest": "^24.2.0",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-clang-format": "^1.0.27", "gulp-clang-format": "^1.0.27",
"jest": "^26.6.3", "jest": "^26.6.3",
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#if defined(__FreeBSD__) && !defined(__Userspace__) #if defined(__FreeBSD__) && !defined(__Userspace__)
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.c 366483 2020-10-06 11:29:08Z tuexen $"); __FBSDID("$FreeBSD$");
#endif #endif
#include <netinet/sctp_os.h> #include <netinet/sctp_os.h>
...@@ -5181,6 +5181,10 @@ out: ...@@ -5181,6 +5181,10 @@ out:
/* Clear net */ /* Clear net */
asoc->last_control_chunk_from = NULL; asoc->last_control_chunk_from = NULL;
} }
if (net == asoc->last_net_cmt_send_started) {
/* Clear net */
asoc->last_net_cmt_send_started = NULL;
}
if (net == stcb->asoc.alternate) { if (net == stcb->asoc.alternate) {
sctp_free_remote_addr(stcb->asoc.alternate); sctp_free_remote_addr(stcb->asoc.alternate);
stcb->asoc.alternate = NULL; stcb->asoc.alternate = NULL;
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#if defined(__FreeBSD__) && !defined(__Userspace__) #if defined(__FreeBSD__) && !defined(__Userspace__)
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD: head/sys/netinet/sctp_timer.c 365071 2020-09-01 21:19:14Z mjg $"); __FBSDID("$FreeBSD$");
#endif #endif
#define _IP_VHL #define _IP_VHL
...@@ -171,8 +171,8 @@ sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb, ...@@ -171,8 +171,8 @@ sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
} }
/* /*
* sctp_find_alternate_net() returns a non-NULL pointer as long * sctp_find_alternate_net() returns a non-NULL pointer as long as there
* the argument net is non-NULL. * exists nets, which are not being deleted.
*/ */
struct sctp_nets * struct sctp_nets *
sctp_find_alternate_net(struct sctp_tcb *stcb, sctp_find_alternate_net(struct sctp_tcb *stcb,
...@@ -181,13 +181,13 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, ...@@ -181,13 +181,13 @@ sctp_find_alternate_net(struct sctp_tcb *stcb,
{ {
/* Find and return an alternate network if possible */ /* Find and return an alternate network if possible */
struct sctp_nets *alt, *mnet, *min_errors_net = NULL , *max_cwnd_net = NULL; struct sctp_nets *alt, *mnet, *min_errors_net = NULL , *max_cwnd_net = NULL;
int once; bool looped;
/* JRS 5/14/07 - Initialize min_errors to an impossible value. */ /* JRS 5/14/07 - Initialize min_errors to an impossible value. */
int min_errors = -1; int min_errors = -1;
uint32_t max_cwnd = 0; uint32_t max_cwnd = 0;
if (stcb->asoc.numnets == 1) { if (stcb->asoc.numnets == 1) {
/* No others but net */ /* No selection can be made. */
return (TAILQ_FIRST(&stcb->asoc.nets)); return (TAILQ_FIRST(&stcb->asoc.nets));
} }
/* /*
...@@ -323,25 +323,22 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, ...@@ -323,25 +323,22 @@ sctp_find_alternate_net(struct sctp_tcb *stcb,
return (max_cwnd_net); return (max_cwnd_net);
} }
} }
mnet = net; /* Look for an alternate net, which is active. */
once = 0; if ((net != NULL) && ((net->dest_state & SCTP_ADDR_BEING_DELETED) == 0)) {
alt = TAILQ_NEXT(net, sctp_next);;
if (mnet == NULL) { } else {
mnet = TAILQ_FIRST(&stcb->asoc.nets); alt = TAILQ_FIRST(&stcb->asoc.nets);
if (mnet == NULL) {
return (NULL);
}
} }
looped = false;
for (;;) { for (;;) {
alt = TAILQ_NEXT(mnet, sctp_next);
if (alt == NULL) { if (alt == NULL) {
once++; if (!looped) {
if (once > 1) {
break;
}
alt = TAILQ_FIRST(&stcb->asoc.nets); alt = TAILQ_FIRST(&stcb->asoc.nets);
looped = true;
}
/* Definitely out of candidates. */
if (alt == NULL) { if (alt == NULL) {
return (NULL); break;
} }
} }
#if defined(__FreeBSD__) && !defined(__Userspace__) #if defined(__FreeBSD__) && !defined(__Userspace__)
...@@ -361,43 +358,56 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, ...@@ -361,43 +358,56 @@ sctp_find_alternate_net(struct sctp_tcb *stcb,
#else #else
(alt->ro.ro_rt != NULL) && (alt->ro.ro_rt != NULL) &&
#endif #endif
(!(alt->dest_state & SCTP_ADDR_UNCONFIRMED))) { (!(alt->dest_state & SCTP_ADDR_UNCONFIRMED)) &&
/* Found a reachable address */ (alt != net)) {
/* Found an alternate net, which is reachable. */
break; break;
} }
mnet = alt; alt = TAILQ_NEXT(alt, sctp_next);
} }
if (alt == NULL) { if (alt == NULL) {
/* Case where NO insv network exists (dormant state) */ /*
/* we rotate destinations */ * In case no active alternate net has been found, look for
once = 0; * an alternate net, which is confirmed.
mnet = net; */
for (;;) { if ((net != NULL) && ((net->dest_state & SCTP_ADDR_BEING_DELETED) == 0)) {
if (mnet == NULL) { alt = TAILQ_NEXT(net, sctp_next);;
return (TAILQ_FIRST(&stcb->asoc.nets)); } else {
alt = TAILQ_FIRST(&stcb->asoc.nets);
} }
alt = TAILQ_NEXT(mnet, sctp_next); looped = false;
for (;;) {
if (alt == NULL) { if (alt == NULL) {
once++; if (!looped) {
if (once > 1) {
break;
}
alt = TAILQ_FIRST(&stcb->asoc.nets); alt = TAILQ_FIRST(&stcb->asoc.nets);
looped = true;
}
/* Definitely out of candidates. */
if (alt == NULL) { if (alt == NULL) {
break; break;
} }
} }
if ((!(alt->dest_state & SCTP_ADDR_UNCONFIRMED)) && if ((!(alt->dest_state & SCTP_ADDR_UNCONFIRMED)) &&
(alt != net)) { (alt != net)) {
/* Found an alternate address */ /* Found an alternate net, which is confirmed. */
break; break;
} }
mnet = alt; alt = TAILQ_NEXT(alt, sctp_next);
} }
} }
if (alt == NULL) { if (alt == NULL) {
return (net); /*
* In case no confirmed alternate net has been found, just
* return net, if it is not being deleted. In the other case
* just return the first net.
*/
if ((net != NULL) && ((net->dest_state & SCTP_ADDR_BEING_DELETED) == 0)) {
alt = net;
}
if (alt == NULL) {
alt = TAILQ_FIRST(&stcb->asoc.nets);
}
} }
return (alt); return (alt);
} }
......
...@@ -2383,14 +2383,19 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, struct sctp_tcb *stcb, ...@@ -2383,14 +2383,19 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, struct sctp_tcb *stcb,
} }
rndval = sctp_select_initial_TSN(&inp->sctp_ep); rndval = sctp_select_initial_TSN(&inp->sctp_ep);
jitter = rndval % to_ticks; jitter = rndval % to_ticks;
if (jitter >= (to_ticks >> 1)) { to_ticks >>= 1;
to_ticks = to_ticks + (jitter - (to_ticks >> 1)); if (jitter < (UINT32_MAX - to_ticks)) {
to_ticks += jitter;
} else { } else {
to_ticks = to_ticks - jitter; to_ticks = UINT32_MAX;
} }
if (!(net->dest_state & SCTP_ADDR_UNCONFIRMED) && if (!(net->dest_state & SCTP_ADDR_UNCONFIRMED) &&
!(net->dest_state & SCTP_ADDR_PF)) { !(net->dest_state & SCTP_ADDR_PF)) {
if (net->heart_beat_delay < (UINT32_MAX - to_ticks)) {
to_ticks += net->heart_beat_delay; to_ticks += net->heart_beat_delay;
} else {
to_ticks = UINT32_MAX;
}
} }
/* /*
* Now we must convert the to_ticks that are now in * Now we must convert the to_ticks that are now in
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论