msc: Only unregister the fd if the fd value is valid.

This makes sure that someone can call bsc_msc_lost multiple times
even if there is no MSC connection. This makes sense as bsc_msc_lost
is public and be called from client code.
This commit is contained in:
Holger Hans Peter Freyther 2010-10-07 06:07:57 +08:00
parent d4eed5208f
commit fad0753b34
1 changed files with 3 additions and 1 deletions

View File

@ -216,7 +216,9 @@ void bsc_msc_lost(struct bsc_msc_connection *con)
{
write_queue_clear(&con->write_queue);
bsc_del_timer(&con->timeout_timer);
bsc_unregister_fd(&con->write_queue.bfd);
if (con->write_queue.bfd.fd >= 0)
bsc_unregister_fd(&con->write_queue.bfd);
connection_loss(con);
}