Code cleanup.

MFC after: 3 days
This commit is contained in:
tuexen 2015-06-12 17:20:09 +00:00
parent 810d2d455b
commit 146839518d

View File

@ -8109,6 +8109,12 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
* it is used to do appropriate
* source address selection.
*/
if (*now_filled == 0) {
(void)SCTP_GETTIME_TIMEVAL(now);
*now_filled = 1;
}
net->last_sent_time = *now;
hbflag = 0;
if ((error = sctp_lowlevel_chunk_output(inp, stcb, net,
(struct sockaddr *)&net->ro._l_addr,
outchain, auth_offset, auth,
@ -8119,21 +8125,18 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
net->port, NULL,
0, 0,
so_locked))) {
/*
* error, we could not
* output
*/
SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error);
if (from_where == 0) {
SCTP_STAT_INCR(sctps_lowlevelerrusr);
}
if (error == ENOBUFS) {
asoc->ifp_had_enobuf = 1;
SCTP_STAT_INCR(sctps_lowlevelerr);
}
if (from_where == 0) {
SCTP_STAT_INCR(sctps_lowlevelerrusr);
}
if (*now_filled == 0) {
(void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time);
*now_filled = 1;
*now = net->last_sent_time;
} else {
net->last_sent_time = *now;
}
hbflag = 0;
/* error, could not output */
if (error == EHOSTUNREACH) {
/*
@ -8145,16 +8148,9 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
}
*reason_code = 7;
break;
} else
asoc->ifp_had_enobuf = 0;
if (*now_filled == 0) {
(void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time);
*now_filled = 1;
*now = net->last_sent_time;
} else {
net->last_sent_time = *now;
asoc->ifp_had_enobuf = 0;
}
hbflag = 0;
/*
* increase the number we sent, if a
* cookie is sent we don't tell them
@ -8387,6 +8383,15 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
sctp_timer_start(SCTP_TIMER_TYPE_COOKIE, inp, stcb, net);
cookie = 0;
}
/* Only HB or ASCONF advances time */
if (hbflag) {
if (*now_filled == 0) {
(void)SCTP_GETTIME_TIMEVAL(now);
*now_filled = 1;
}
net->last_sent_time = *now;
hbflag = 0;
}
if ((error = sctp_lowlevel_chunk_output(inp, stcb, net,
(struct sockaddr *)&net->ro._l_addr,
outchain,
@ -8398,23 +8403,17 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
net->port, NULL,
0, 0,
so_locked))) {
if (error == ENOBUFS) {
asoc->ifp_had_enobuf = 1;
SCTP_STAT_INCR(sctps_lowlevelerr);
}
/*
* error, we could not
* output
*/
SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error);
if (from_where == 0) {
SCTP_STAT_INCR(sctps_lowlevelerrusr);
}
/* error, could not output */
if (hbflag) {
if (*now_filled == 0) {
(void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time);
*now_filled = 1;
*now = net->last_sent_time;
} else {
net->last_sent_time = *now;
}
hbflag = 0;
if (error == ENOBUFS) {
asoc->ifp_had_enobuf = 1;
SCTP_STAT_INCR(sctps_lowlevelerr);
}
if (error == EHOSTUNREACH) {
/*
@ -8426,18 +8425,8 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
}
*reason_code = 7;
break;
} else
} else {
asoc->ifp_had_enobuf = 0;
/* Only HB or ASCONF advances time */
if (hbflag) {
if (*now_filled == 0) {
(void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time);
*now_filled = 1;
*now = net->last_sent_time;
} else {
net->last_sent_time = *now;
}
hbflag = 0;
}
/*
* increase the number we sent, if a
@ -8729,6 +8718,14 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
*/
sctp_timer_start(SCTP_TIMER_TYPE_SEND, inp, stcb, net);
}
if (bundle_at || hbflag) {
/* For data/asconf and hb set time */
if (*now_filled == 0) {
(void)SCTP_GETTIME_TIMEVAL(now);
*now_filled = 1;
}
net->last_sent_time = *now;
}
/* Now send it, if there is anything to send :> */
if ((error = sctp_lowlevel_chunk_output(inp,
stcb,
@ -8747,23 +8744,13 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
0, 0,
so_locked))) {
/* error, we could not output */
if (error == ENOBUFS) {
SCTP_STAT_INCR(sctps_lowlevelerr);
asoc->ifp_had_enobuf = 1;
}
SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error);
if (from_where == 0) {
SCTP_STAT_INCR(sctps_lowlevelerrusr);
}
SCTPDBG(SCTP_DEBUG_OUTPUT3, "Gak send error %d\n", error);
if (hbflag) {
if (*now_filled == 0) {
(void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time);
*now_filled = 1;
*now = net->last_sent_time;
} else {
net->last_sent_time = *now;
}
hbflag = 0;
if (error == ENOBUFS) {
SCTP_STAT_INCR(sctps_lowlevelerr);
asoc->ifp_had_enobuf = 1;
}
if (error == EHOSTUNREACH) {
/*
@ -8788,16 +8775,6 @@ sctp_med_chunk_output(struct sctp_inpcb *inp,
endoutchain = NULL;
auth = NULL;
auth_offset = 0;
if (bundle_at || hbflag) {
/* For data/asconf and hb set time */
if (*now_filled == 0) {
(void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time);
*now_filled = 1;
*now = net->last_sent_time;
} else {
net->last_sent_time = *now;
}
}
if (!no_out_cnt) {
*num_out += (ctl_cnt + bundle_at);
}