Re: Why would CFReadStreamSetProperty return FALSE? - Resolved
Re: Why would CFReadStreamSetProperty return FALSE? - Resolved
- Subject: Re: Why would CFReadStreamSetProperty return FALSE? - Resolved
- From: Martin Redington <email@hidden>
- Date: Fri, 27 Jan 2006 07:34:26 +0000
I managed to fix this by moving the SSL certificate retrieval into the
connection thread.
I'm not entirely sure what changed, as I'm sure my test case (the one
that didn't show the same error) retrieved the cert in the main
thread, but moving it in my main app worked.
On 1/22/06, Martin Redington <email@hidden> wrote:
> Hi Jeremy
>
> On 1/22/06, Jeremy Wyld <email@hidden> wrote:
> >
> > On Jan 22, 2006, at 8:23 AM, Martin Redington wrote:
> >
> >
> > I'm also using CFReadStreamSetProperty to set the
> >
> > kCFStreamPropertySocketSecurityLevel entry, and that works
> > fine.
> >
> > I'm confused by this bit. Are you also calling this in addition to
> > kCFStreamPropertySSLSettings?
>
> yep. It did seem a little redundant, but the docs didn't say anything
> about not setting both.
>
> My code looks like this (although the new code checks the setProperty
> return values.
>
> CFTypeRef secLevel = (CFTypeRef) [sslProps objectForKey:(NSString
> *)kCFStreamSSLLevel];
>
> CFReadStreamSetProperty(readStreamRef,
> kCFStreamPropertySocketSecurityLevel, secLevel);
> CFWriteStreamSetProperty(writeStreamRef,
> kCFStreamPropertySocketSecurityLevel, secLevel);
>
> CFReadStreamSetProperty(readStreamRef, kCFStreamPropertySSLSettings, sslProps);
> CFWriteStreamSetProperty(writeStreamRef, kCFStreamPropertySSLSettings,
> sslProperties);
>
> > There should be no threading issues associated with making these calls per
> > se. Because you're making them from another thread, you always run a risk
> > of not issuing the calls at the correct time unless your protocol has a
> > mechanism to "know" when to do it.
>
> The entire connection is being run in this thread, so I don't think
> that's an issue (and my logging indicates that the sequencing is as
> intended).
>
> > You can always look at the CFSocketStream source.
> > http://darwinsource.opendarwin.org/10.4/CFNetwork-128/Stream/CFSocketStream.c
> >
> > The functions that you're interested in are
> > _SocketStreamSecuritySetContext_NoLock and
> > _SocketStreamSecuritySetInfo_NoLock.
>
> Thanks very much for the pointer. I'm just looking at
> _SocketStreamSecuritySetInfo_NoLock now.
>
> cheers,
> Martin
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden