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

Multi thread safety #179

Open
shaiamir opened this issue Apr 9, 2017 · 1 comment
Open

Multi thread safety #179

shaiamir opened this issue Apr 9, 2017 · 1 comment

Comments

@shaiamir
Copy link

shaiamir commented Apr 9, 2017

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

@mikey0000
Copy link
Collaborator

Dunno this library is pretty much unmaintained now. Yes I am a maintainer on this lib. PR's welcome.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants