Merge pull request #1508 from qlyoung/bgpd-fix-lock

bgpd: fix potential deadlock
This commit is contained in:
Rafael Zalamena 2017-12-04 11:16:45 -02:00 committed by GitHub
commit 6bbda63df7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -556,12 +556,14 @@ static int bgp_write_notify(struct peer *peer)
{
/* There should be at least one packet. */
s = stream_fifo_pop(peer->obuf);
if (!s)
return 0;
assert(stream_get_endp(s) >= BGP_HEADER_SIZE);
}
pthread_mutex_unlock(&peer->io_mtx);
if (!s)
return 0;
assert(stream_get_endp(s) >= BGP_HEADER_SIZE);
/* Stop collecting data within the socket */
sockopt_cork(peer->fd, 0);