Don't crash when the socket gets closed between updates.
Also, this time not only update `remains', but update it right :)
This commit is contained in:
parent
6b5ab87581
commit
0c3588bf5e
2 changed files with 13 additions and 5 deletions
2
TODO
2
TODO
|
@ -22,6 +22,8 @@ Core
|
||||||
- client: paging?
|
- client: paging?
|
||||||
- client: data losses on large dumps?
|
- client: data losses on large dumps?
|
||||||
|
|
||||||
|
- table: ocassional core dumps in rt_prune()
|
||||||
|
|
||||||
- bgp: timing of updates?
|
- bgp: timing of updates?
|
||||||
- bgp: dump and get_route_info
|
- bgp: dump and get_route_info
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ bgp_encode_prefixes(struct bgp_proto *p, byte *w, struct bgp_bucket *buck, unsig
|
||||||
ipa_hton(a);
|
ipa_hton(a);
|
||||||
memcpy(w, &a, bytes);
|
memcpy(w, &a, bytes);
|
||||||
w += bytes;
|
w += bytes;
|
||||||
remains -= bytes;
|
remains -= bytes + 1;
|
||||||
rem_node(&px->bucket_node);
|
rem_node(&px->bucket_node);
|
||||||
fib_delete(&p->prefix_fib, px);
|
fib_delete(&p->prefix_fib, px);
|
||||||
}
|
}
|
||||||
|
@ -232,11 +232,17 @@ bgp_fire_tx(struct bgp_conn *conn)
|
||||||
struct bgp_proto *p = conn->bgp;
|
struct bgp_proto *p = conn->bgp;
|
||||||
unsigned int s = conn->packets_to_send;
|
unsigned int s = conn->packets_to_send;
|
||||||
sock *sk = conn->sk;
|
sock *sk = conn->sk;
|
||||||
byte *buf = sk->tbuf;
|
byte *buf, *pkt, *end;
|
||||||
byte *pkt = buf + BGP_HEADER_LENGTH;
|
|
||||||
byte *end;
|
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
|
if (!sk)
|
||||||
|
{
|
||||||
|
conn->packets_to_send = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
buf = sk->tbuf;
|
||||||
|
pkt = buf + BGP_HEADER_LENGTH;
|
||||||
|
|
||||||
if (s & (1 << PKT_SCHEDULE_CLOSE))
|
if (s & (1 << PKT_SCHEDULE_CLOSE))
|
||||||
{
|
{
|
||||||
bgp_close_conn(conn);
|
bgp_close_conn(conn);
|
||||||
|
@ -284,7 +290,7 @@ bgp_schedule_packet(struct bgp_conn *conn, int type)
|
||||||
{
|
{
|
||||||
DBG("BGP: Scheduling packet type %d\n", type);
|
DBG("BGP: Scheduling packet type %d\n", type);
|
||||||
conn->packets_to_send |= 1 << type;
|
conn->packets_to_send |= 1 << type;
|
||||||
if (conn->sk->tpos == conn->sk->tbuf)
|
if (conn->sk && conn->sk->tpos == conn->sk->tbuf)
|
||||||
while (bgp_fire_tx(conn))
|
while (bgp_fire_tx(conn))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue