diff options
author | samr7 <samr7@126591fb-c623-4b62-a76d-97a8e4f34109> | 2008-12-20 10:28:03 +0000 |
---|---|---|
committer | samr7 <samr7@126591fb-c623-4b62-a76d-97a8e4f34109> | 2008-12-20 10:28:03 +0000 |
commit | a50d988cb2420fbeca743b0663949ebe79f8b5cf (patch) | |
tree | 60d61c1e0e7e22e1e90f090dce3e76061096a267 | |
parent | 290629adc55398824f9086cc6aa7ce391dbb9ccb (diff) | |
download | nohands-a50d988cb2420fbeca743b0663949ebe79f8b5cf.tar.gz |
Allow inbound connections to existing RFCOMM sessions.
git-svn-id: http://nohands.svn.sourceforge.net/svnroot/nohands/trunk@77 126591fb-c623-4b62-a76d-97a8e4f34109
-rw-r--r-- | libhfp/hfp.cpp | 6 | ||||
-rw-r--r-- | libhfp/rfcomm.cpp | 4 |
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; } |