Wan-Teh Chang wrote:
> Peter Djalaliev wrote:
>>
>> I also tried PR_GetUniqueIdentity and was a little
>> surprised that I would get a different identity for "SSL" with each
>> call.  I mean, the name of the function implies it, but would one
>> really need to have different FD layers corresponding to the same
>> protocol?
> 
> Right.  PR_GetUniqueIdentity registers a new I/O layer with the
> specified name.  It doesn't check to see if a layer with the same
> name has already been registered.  I don't know why.

I consider its present behavior to be a bug.  It means the value
returned does not uniquely identify the named layer.  It means there
is not necessarily a single unique identifier for each named layer.

> Your suggestion of a new PR_GetIdentityForName function seems good.
> I would define it as follows:
> 
> PRDescIdentity
> PR_GetIdentityForName(const char* layerName) {
>     ...
>     if (no existing layer with this name)
>         return PR_INVALID_IO_LAYER;
>     else
>         return identity_of_existing_layer
> }

I think we want the query-or-set function to be atomic.  We want a
function that either registers a new layer name exactly once, or
returns the previously registered value, and does not allow duplicate
names in the table.

The combination of the existing PR_GetUniqueIdentity and this new
proposed PR_GetIdentityForName will not give us that atomic behavior.

> In any case, do you know how to solve your original problem now?
> 
> Wan-Teh
> 
_______________________________________________
dev-tech-crypto mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to