Closed tczf1128 closed 7 years ago
Hi, could you describe your use case that needs timeout?
I use gotty with docker exec -it DOCKER_ID /bin/bash
to show the terminal of container, then users can access to the container, and if no one connect it in 10 minutes, the gotty should exit
Thanks.
I feel like it's a bit special use case, so let me keep this issue open to collect the same request from others.
Thanks
+1 the same case
+1 almost the same case. I need timeout option too. Quit command is also OK. I hacked gotty and use it parallel to call command. In this way, it supports mutilple connections.
I figured out a solution, but it's not perfect so far. I set a count down timer when each connection is established. It will do the following.
gotty -w --timeout=60 <cmd>
. boom
which will cause disconnection.Rewind()
will be called inside processReceive()
and processSend()
. The Rewind()
function will set the left time to initial value(the one in gotty command line). The timer will count down again and do same thing in step 2.
It works like a old-fashioned stopwatch.The issue is, when I run command like sleep 80
or start a long-run programme like top
. It will disconnect when timeout. This bothers in some cases.
PR is in #115 . It differ a bit as @tczf1128 descripbed the issue. Gotty will not exit when timeout, but the cmd will exit and gotty web page shows a Connection closed
label.
+1 I need timeout to free TCP port for further connections. My case is multiple GoTTY instances running on one server in a specific port range, I'd like to use timeout to free used ports and server resources.
@zyfdegh Thanks for your work and the PR. It's possible to make optionally GoTTY exit/no exit behaviour? Maybe one more command line option?
@oneumyvakin View my fork on github.com/zyfdegh/gotty, it supports --timeout
option. But I modified some source codes, so gotty will work a bit differently.
Added --timeout
option :)
gotty exit if no client connect to it