Skip to content
This repository was archived by the owner on Apr 17, 2019. It is now read-only.
This repository was archived by the owner on Apr 17, 2019. It is now read-only.

Multi thread safety #179

Open
Open
@shaiamir

Description

@shaiamir

First thanks for the great library.
After some digging in the code I have a question regarding thread safety. I am new to iOS so I may be mistaken here.

It seems to me that there could be races in the code between the flows that handle incoming messages and calls that the library user performs. For instance, when the user calls:
callMethodName:parameters:responseCallback
the flow eventually adds entries to _responseCallbacks (a NSMutableDictionary) and to _methodIds (a NSMutableSet). Both are used and manipulated when receiving callbacks from the SRWebSocket.

Now there is a provision for this to work correctly via [SWWebSocket setDelegateDispatchQueue] but connectWebSocket does not wait for the user to set the dispatch queue before connecting so at least the first callback might happen on the wrong dispatch queue.

Am I missing something?
Should a member be added to ObjectiveDDP that will hold the dispatch queue to use with the SRWebSocket?

Thanks,
Shai

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions