mirror of git://git.sysmocom.de/ofono
dundee: explicit shutdown the bluetooth file descriptor
If we do not shut it down the fd can remain opened. This make impossible to try a re-connect: busy is returned in this case. We call shutdown here to make sure that the link is always closed.
This commit is contained in:
parent
8181ee6b95
commit
371b886bab
|
@ -28,6 +28,7 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
@ -44,6 +45,8 @@ struct bluetooth_device {
|
||||||
char *address;
|
char *address;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
|
int fd;
|
||||||
|
|
||||||
DBusPendingCall *call;
|
DBusPendingCall *call;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -54,6 +57,8 @@ static void bt_disconnect(struct dundee_device *device,
|
||||||
|
|
||||||
DBG("%p", bt);
|
DBG("%p", bt);
|
||||||
|
|
||||||
|
shutdown(bt->fd, SHUT_RDWR);
|
||||||
|
|
||||||
CALLBACK_WITH_SUCCESS(cb, data);
|
CALLBACK_WITH_SUCCESS(cb, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +98,8 @@ static void bt_connect_reply(DBusPendingCall *call, gpointer user_data)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bt->fd = fd;
|
||||||
|
|
||||||
CALLBACK_WITH_SUCCESS(cb, fd, cbd->data);
|
CALLBACK_WITH_SUCCESS(cb, fd, cbd->data);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
Loading…
Reference in New Issue