Coder Social home page Coder Social logo

Comments (5)

AricStewart avatar AricStewart commented on May 17, 2024

Here is the functional patch, without the command line switch:


diff --git a/websocket.py b/websocket.py
index 11f718c..1bb83c0 100644
--- a/websocket.py
+++ b/websocket.py
@@ -837,9 +837,14 @@ Sec-WebSocket-Accept: %s\r
                     self.client = None
                     startsock = None
                     pid = err = 0
+                    child_count = 0
+
+                    if multiprocessing and self.timeout:
+                        child_count = len(multiprocessing.active_children())
 
                     time_elapsed = time.time() - self.launch_time
-                    if self.timeout and time_elapsed > self.timeout:
+                    if self.timeout and time_elapsed > self.timeout
+                       and child_count == 0:
                         self.msg('listener exit due to --timeout %s'
                                 % self.timeout)
                         break

from websockify.

kanaka avatar kanaka commented on May 17, 2024

Yes, that's a reasonable change. I think it should be a separate option from the normal --timeout. Something like --idle-timeout. --timeout would be how long to listen for new connections, and --idle-timeout would be how long to stick around when there are no active connections.

Also, it would be easiest if you fork, make the changes and issue a pull request. Thanks.

from websockify.

AricStewart avatar AricStewart commented on May 17, 2024

Thanks still new to GitHub and how things work here. I will try to get a pull request issued.

from websockify.

AricStewart avatar AricStewart commented on May 17, 2024

Thanks for the help I have issued the pull request and hope I have done it properly. Thank you very much for your patience.

from websockify.

kanaka avatar kanaka commented on May 17, 2024

@AricStewart, sorry for the delay. Day job and all that. The change looks good. Thanks for the contribution.

from websockify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.