It's better to add "timeout" option #78

Closed
tczf1128 opened this Issue Oct 13, 2015 · 12 comments

Comments

Projects
None yet
5 participants
@tczf1128

gotty exit if no client connect to it

@yudai

This comment has been minimized.

Show comment
Hide comment
@yudai

yudai Oct 13, 2015

Owner

Hi, could you describe your use case that needs timeout?

Owner

yudai commented Oct 13, 2015

Hi, could you describe your use case that needs timeout?

@yudai yudai added the status/triage label Oct 13, 2015

@tczf1128

This comment has been minimized.

Show comment
Hide comment
@tczf1128

tczf1128 Oct 14, 2015

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

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

@yudai yudai modified the milestones: v0.1.0, icebox Oct 14, 2015

@yudai

This comment has been minimized.

Show comment
Hide comment
@yudai

yudai Oct 14, 2015

Owner

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.

Owner

yudai commented Oct 14, 2015

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.

@tczf1128

This comment has been minimized.

Show comment
Hide comment

Thanks

@wagnersza

This comment has been minimized.

Show comment
Hide comment
@wagnersza

wagnersza May 13, 2016

+1 the same case

+1 the same case

@zyfdegh

This comment has been minimized.

Show comment
Hide comment
@zyfdegh

zyfdegh Jul 28, 2016

Contributor

+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.

Contributor

zyfdegh commented Jul 28, 2016

+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.

@zyfdegh

This comment has been minimized.

Show comment
Hide comment
@zyfdegh

zyfdegh Aug 14, 2016

Contributor

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.

  1. The timeout interval is set when you run gotty like gotty -w --timeout=60 <cmd>.
  2. The left time is decreasing 1 every second since the connection is established. If user has no operation on the gotty web page, it will count down to 0 and will trigger a function named boom which will cause disconnection.
  3. The left time will be set to init value if the user has typed anything on gotty web page. To say technically, function 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.

Contributor

zyfdegh commented Aug 14, 2016

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.

  1. The timeout interval is set when you run gotty like gotty -w --timeout=60 <cmd>.
  2. The left time is decreasing 1 every second since the connection is established. If user has no operation on the gotty web page, it will count down to 0 and will trigger a function named boom which will cause disconnection.
  3. The left time will be set to init value if the user has typed anything on gotty web page. To say technically, function 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.

@zyfdegh

This comment has been minimized.

Show comment
Hide comment
@zyfdegh

zyfdegh Aug 14, 2016

Contributor

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.

Contributor

zyfdegh commented Aug 14, 2016

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.

@oneumyvakin

This comment has been minimized.

Show comment
Hide comment
@oneumyvakin

oneumyvakin Oct 16, 2016

+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.

+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.

@oneumyvakin

This comment has been minimized.

Show comment
Hide comment
@oneumyvakin

oneumyvakin Oct 16, 2016

@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?

@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?

@zyfdegh

This comment has been minimized.

Show comment
Hide comment
@zyfdegh

zyfdegh Oct 17, 2016

Contributor

@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.

Contributor

zyfdegh commented Oct 17, 2016

@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.

@yudai

This comment has been minimized.

Show comment
Hide comment
@yudai

yudai Jan 9, 2017

Owner

Added --timeout option :)

Owner

yudai commented Jan 9, 2017

Added --timeout option :)

@yudai yudai closed this May 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment