This repository has been archived by the owner on Apr 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Memory crash fix #4
Open
adamjernst
wants to merge
14
commits into
fpotter:master
Choose a base branch
from
adamjernst:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…beat timer was the last retaining reference to self.
…o auto-reconnect after timeout, those messages would be dropped. Likewise, if the user manually tried reconnecting after a disconnection any queued messages would be dropped. Instead just let the queue be released in dealloc as it already is.
Also, don't clear the queue on disconnection. See notes in commit message. |
All delegate methods are now optional. A new delegate method, -socketIoClient:didFailWithError:, is called when an underlying error occurs, or when the connection or heartbeat times out. Removed tryAgainOnConnectTimeout as it is confusing and error-prone. Instead, delegates should check for SocketIoClientErrorConnectionTimeout and call -connect to try again if they desire. The queue of outgoing messages is preserved between attempts. When heartbeat times out, explicitly disconnect the underlying socket immediately. Previously, the socket was left open so SocketIoClient could miraculously pop back open after a heartbeat timeout.
…-disconnect, so you don't subsequently get a timeout error anyway. Second, actually send the heartbeat timeout error.
First, use a state variable instead of potentially contradictory boolean flags. Introduce a new delegate method socketIoClient:connectDidFailWithError: that is called when an attempt to connect fails. Document that EITHER socketIoClient:connectDidFailWithError: is called, OR socketIoClient:didDisconnectWithError: is called, but not both. (The latter is called only if a connection is established, signaled by socketIoClientDidConnect:). Make it safe to immediately retry the connection in the delegate error handling functions by deferring their execution until the next run loop.
…eclare properties.
… the previous commits.
…o that it isn't called more than once if connect is called repeatedly. Also add two new logging statements, improve the logging output to show the socket doing the logging, and respect a SOCKETIO_DEBUG flag instead of just commenting out the NSLog.
…so, onConnectError should cancel the connect timeout.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix a memory management problem that could cause a crash if the heartbeat timer was the last retaining reference to self.