From a50d988cb2420fbeca743b0663949ebe79f8b5cf Mon Sep 17 00:00:00 2001 From: samr7 Date: Sat, 20 Dec 2008 10:28:03 +0000 Subject: Allow inbound connections to existing RFCOMM sessions. git-svn-id: http://nohands.svn.sourceforge.net/svnroot/nohands/trunk@77 126591fb-c623-4b62-a76d-97a8e4f34109 --- libhfp/hfp.cpp | 6 ++++++ libhfp/rfcomm.cpp | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'libhfp') 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; } -- cgit v1.2.1