summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/gliderlabs/ssh/conn.go
diff options
context:
space:
mode:
authortechknowlogick <techknowlogick@gitea.io>2022-01-14 18:16:05 -0500
committerGitHub <noreply@github.com>2022-01-14 18:16:05 -0500
commit84145e45c50130922fae9055535ab5ea0378e1d4 (patch)
treefce077a5ae462840bb876ace79aca42abab29ed7 /vendor/github.com/gliderlabs/ssh/conn.go
parent2b16ca7c773de278ba01f122dc6f9f43d7534c52 (diff)
downloadgitea-84145e45c50130922fae9055535ab5ea0378e1d4.tar.gz
gitea-84145e45c50130922fae9055535ab5ea0378e1d4.zip
Remove golang vendored directory (#18277)
* rm go vendor * fix drone yaml * add to gitignore
Diffstat (limited to 'vendor/github.com/gliderlabs/ssh/conn.go')
-rw-r--r--vendor/github.com/gliderlabs/ssh/conn.go55
1 files changed, 0 insertions, 55 deletions
diff --git a/vendor/github.com/gliderlabs/ssh/conn.go b/vendor/github.com/gliderlabs/ssh/conn.go
deleted file mode 100644
index ebef8845ba..0000000000
--- a/vendor/github.com/gliderlabs/ssh/conn.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package ssh
-
-import (
- "context"
- "net"
- "time"
-)
-
-type serverConn struct {
- net.Conn
-
- idleTimeout time.Duration
- maxDeadline time.Time
- closeCanceler context.CancelFunc
-}
-
-func (c *serverConn) Write(p []byte) (n int, err error) {
- c.updateDeadline()
- n, err = c.Conn.Write(p)
- if _, isNetErr := err.(net.Error); isNetErr && c.closeCanceler != nil {
- c.closeCanceler()
- }
- return
-}
-
-func (c *serverConn) Read(b []byte) (n int, err error) {
- c.updateDeadline()
- n, err = c.Conn.Read(b)
- if _, isNetErr := err.(net.Error); isNetErr && c.closeCanceler != nil {
- c.closeCanceler()
- }
- return
-}
-
-func (c *serverConn) Close() (err error) {
- err = c.Conn.Close()
- if c.closeCanceler != nil {
- c.closeCanceler()
- }
- return
-}
-
-func (c *serverConn) updateDeadline() {
- switch {
- case c.idleTimeout > 0:
- idleDeadline := time.Now().Add(c.idleTimeout)
- if idleDeadline.Unix() < c.maxDeadline.Unix() || c.maxDeadline.IsZero() {
- c.Conn.SetDeadline(idleDeadline)
- return
- }
- fallthrough
- default:
- c.Conn.SetDeadline(c.maxDeadline)
- }
-}