mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-06 22:44:38 +08:00
PPP, minor coding style fix
This commit is contained in:
parent
987f6237c4
commit
91e40e668c
@ -755,8 +755,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
|
||||
|| protocol == PPP_EAP
|
||||
#endif /* EAP_SUPPORT */
|
||||
)) {
|
||||
ppp_dbglog("discarding proto 0x%x in phase %d",
|
||||
protocol, pcb->phase);
|
||||
ppp_dbglog("discarding proto 0x%x in phase %d", protocol, pcb->phase);
|
||||
goto drop;
|
||||
}
|
||||
|
||||
@ -912,7 +911,6 @@ drop:
|
||||
out:
|
||||
pbuf_free(pb);
|
||||
magic_randomize();
|
||||
return;
|
||||
}
|
||||
|
||||
/* merge a pbuf chain into one pbuf */
|
||||
@ -1531,9 +1529,11 @@ struct protocol_list {
|
||||
const char * protocol_name(int proto) {
|
||||
struct protocol_list *lp;
|
||||
|
||||
for (lp = protocol_list; lp->proto != 0; ++lp)
|
||||
if (proto == lp->proto)
|
||||
for (lp = protocol_list; lp->proto != 0; ++lp) {
|
||||
if (proto == lp->proto) {
|
||||
return lp->name;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif /* PPP_PROTOCOLNAME */
|
||||
@ -1550,8 +1550,9 @@ const char * protocol_name(int proto) {
|
||||
* reset_link_stats - "reset" stats when link goes up.
|
||||
*/
|
||||
void reset_link_stats(int u) {
|
||||
if (!get_ppp_stats(u, &old_link_stats))
|
||||
if (!get_ppp_stats(u, &old_link_stats)) {
|
||||
return;
|
||||
}
|
||||
gettimeofday(&start_time, NULL);
|
||||
}
|
||||
|
||||
@ -1559,13 +1560,12 @@ void reset_link_stats(int u) {
|
||||
* update_link_stats - get stats at link termination.
|
||||
*/
|
||||
void update_link_stats(int u) {
|
||||
|
||||
struct timeval now;
|
||||
char numbuf[32];
|
||||
|
||||
if (!get_ppp_stats(u, &link_stats)
|
||||
|| gettimeofday(&now, NULL) < 0)
|
||||
if (!get_ppp_stats(u, &link_stats) || gettimeofday(&now, NULL) < 0) {
|
||||
return;
|
||||
}
|
||||
link_connect_time = now.tv_sec - start_time.tv_sec;
|
||||
link_stats_valid = 1;
|
||||
|
||||
@ -1582,8 +1582,7 @@ void print_link_stats() {
|
||||
if (link_stats_valid) {
|
||||
int t = (link_connect_time + 5) / 6; /* 1/10ths of minutes */
|
||||
info("Connect time %d.%d minutes.", t/10, t%10);
|
||||
info("Sent %u bytes, received %u bytes.",
|
||||
link_stats.bytes_out, link_stats.bytes_in);
|
||||
info("Sent %u bytes, received %u bytes.", link_stats.bytes_out, link_stats.bytes_in);
|
||||
link_stats_valid = 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user