summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libhfp/hfp.cpp6
-rw-r--r--libhfp/rfcomm.cpp4
2 files changed, 8 insertions, 2 deletions
diff --git a/libhfp/hfp.cpp b/libhfp/hfp.cpp
index 5ddeb57..6a979c7 100644
--- a/libhfp/hfp.cpp
+++ b/libhfp/hfp.cpp
@@ -564,6 +564,8 @@ SessionFactory(BtDevice *devp)
HfpSession *sessp;
assert(GetHub());
+ assert(!FindSession(devp));
+
if (cb_HfpSessionFactory.Registered())
sessp = cb_HfpSessionFactory(devp);
else
@@ -771,6 +773,10 @@ NotifyConnectionState(ErrorInfo *async_error)
if (!HfpHandshake(&local_error))
__Disconnect(&local_error, false);
+
+ else if (IsConnectionRemoteInitiated() &&
+ cb_NotifyConnection.Registered())
+ cb_NotifyConnection(this, 0);
}
else {
diff --git a/libhfp/rfcomm.cpp b/libhfp/rfcomm.cpp
index 2a42203..b2ef2ad 100644
--- a/libhfp/rfcomm.cpp
+++ b/libhfp/rfcomm.cpp
@@ -159,10 +159,10 @@ RfcommListenNotify(SocketNotifier *notp, int fh)
}
/* Instantiate a session */
- sessp = SessionFactory(devp);
+ sessp = GetSession(devp, true);
+ devp->Put();
if (!sessp) {
close(rsock);
- devp->Put();
return;
}