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.
Only the last commit is relevant here, as the others are from #13
I'll rebase this PR onces #13 is merged.
This basically removes all the
foo.kill
. It looks like "it works" but I didn't give it a lot of testing.By the way, does https://github.com/Silex/mjpeg-relay/blob/217904d862cade494d031667d9e30884a9e1e34d/relay.py#L26 really make sense? I know it works, but theorically how can
quit()
access global variables here? I guess I don't know python enough 😝I think it's simpler to move the quit() body at the bottom of the try block, and remove the quit() calls. There's no real need to have multiple exit paths.
I was thinking of refactoring a bit more and replacing the
foo.connected
thing with a function instead, that way we can get rid of the variable and the check is always accurate (simply return the socket state).Also, each of these "servers" should have a saner start/stop mechanism. At the moment the thread thing for each of them is a bit weird... not the thread in itself but its permanence. I think in general, "start" should start listening/open the socket and spawn a thread, and stop should close the socket/server and kill the thread.
I'll see what I can do, and ping you when I have something. Give me your thoughts in the meantime 😉
p.s: you code on windows? I was a bit surprised by the windows line endings.