- Notifications
You must be signed in to change notification settings - Fork 41
Rename start/stop to resume/suspend #82
Conversation
helje5 left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks weird without having PR 81 first: #81
And now I'm wondering whether suspend is the same as stop. suspend would probably still have the socket open (which may fill up to the listen queue), while stop might actually close the socket.
| This PR would be blocked by #81 |
| ok I mistyped - I meant to say I agree that this PR is blocked by #81 for it to make sense. |
| I think we need to consider what we want the lifecycle to be, and whether following Dispatch is the right approach for a server. Dispatch queues have the following:
which I'm not convinced makes necessarily sense for a server. To be I think the following are the likely possible events in the lifecycle:
Which of these do we think makes sense to have? On a separate note, today if you call |
| When suggesting I also thought about this, but I'm against starting actual work in Also keep in mind that the server might be running on a device, so you need to suspend/resume it when going to the background (which btw could assign new kernel assigned ports when going foreground again!). P.S.: I don't get the thing about the start-stop crash, what does it have to do w/ the naming? start+stop shouldn't crash, neither should resume+suspend :-> |
It was an aside that really says that if we added a test as part of the PR for stop/start (or suspend/resume naming of the current APIs) it would crash - so theres more work to do than just naming. Would this be the set that we'd ideally want?
|
| I'm wondering whether we need some extra support for iOS back/foreground handling (you need to close the listen sockets and reopen them when going back to foreground). Or would we want the dev to restart the server from scratch? But then all connections would always die. I guess it could also be automatic by listening to the notifications (but then you loose control when that happens, which might be important to the app). |
| @seabaylea I don't understand what Additional question is, do the following lifecycle make sense?
Once we clarify the lifecycle of the server, we will make sure we have appropriate tests for them. |
| Btw if the lifecycle of the server has not been decided on, I can open a new issue to track that. Thoughts @carlbrown @seabaylea @helje5 ? |
| I think this could evolve into the issue tracking the lifecycle. (and the names would be just a result of this)
The socket would still be open, bound and listening, but not calling For iOS, apps really need to close when going bg and completely reopen listen socks when going fg (unless you have special VoIP like blessing, in that mode the kernel will ensure the listen sockets stay alive - which may or may not be another thing we would want to support). |
| Going to defer this one and see if it's still needed after #96 |
| We still need to decide on lifecycle and naming, I'd reopen this one. #96 doesn't change much on the surface of the API (apart from the queue argument). |
| Opened #98 to track the discussions about server lifecycle. |
Rename start/stop to resume/suspend to match what GCD and Cocoa are doing.
Affects:
HTTPServing protocol
HTTPServer class
PoCSocketSimpleServer