diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-11-25 15:31:15 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-11-25 16:52:25 +0100 |
commit | bfedfa5fb8d21043fbc5fec988df706c14292b1b (patch) | |
tree | 4c9ddc11f9c4f4645081546e3b66469739806b93 | |
parent | d1032d1f01709257c2350232453294f60325ecc2 (diff) |
msc: Only unregister the fd when we have a valid fd
Conflicts:
src/msc_conn.c
-rw-r--r-- | src/msc_conn.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/msc_conn.c b/src/msc_conn.c index 8ea1f88..0957bc3 100644 --- a/src/msc_conn.c +++ b/src/msc_conn.c @@ -54,9 +54,12 @@ void msc_close_connection(struct msc_connection *fw) { struct bsc_fd *bfd = &fw->msc_connection.bfd; - close(bfd->fd); - bsc_unregister_fd(bfd); - bfd->fd = -1; + if (bfd->fd >= 0) { + close(bfd->fd); + bsc_unregister_fd(bfd); + bfd->fd = -1; + } + fw->msc_link_down = 1; release_bsc_resources(fw); bsc_del_timer(&fw->ping_timeout); @@ -546,6 +549,7 @@ struct msc_connection *msc_connection_create(struct bsc_data *bsc, int mgcp) msc->msc_connection.read_cb = ipaccess_a_fd_cb; msc->msc_connection.write_cb = ipaccess_write_cb; msc->msc_connection.bfd.data = msc; + msc->msc_connection.bfd.fd = -1; msc->msc_link_down = 1; /* handle the timeout */ |