mirror of https://gogs.blitter.com/RLabs/xs
Merge branch 'master' into kcp-udp
This commit is contained in:
commit
ce1adf7a07
2
Makefile
2
Makefile
|
@ -5,7 +5,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GIT_COMMIT := $(shell git rev-list -1 HEAD)
|
GIT_COMMIT := $(shell git rev-list -1 HEAD)
|
||||||
VERSION := 0.8.6
|
VERSION := 0.8.7
|
||||||
#ifeq ($(BUILDOPTS),)
|
#ifeq ($(BUILDOPTS),)
|
||||||
BUILDOPTS :=$(BUILDOPTS)" -ldflags \"-X main.version=$(VERSION) -X main.gitCommit=$(GIT_COMMIT)\""
|
BUILDOPTS :=$(BUILDOPTS)" -ldflags \"-X main.version=$(VERSION) -X main.gitCommit=$(GIT_COMMIT)\""
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -70,10 +70,9 @@ type (
|
||||||
|
|
||||||
// Conn is a connection wrapping net.Conn with KEX & session state
|
// Conn is a connection wrapping net.Conn with KEX & session state
|
||||||
Conn struct {
|
Conn struct {
|
||||||
kex KEXAlg // KEX/KEM proposal (client -> server)
|
kex KEXAlg // KEX/KEM proposal (client -> server)
|
||||||
m *sync.Mutex // (internal)
|
m *sync.Mutex // (internal)
|
||||||
c *net.Conn // which also implements io.Reader, io.Writer, ...
|
c *net.Conn // which also implements io.Reader, io.Writer, ...
|
||||||
immClose bool
|
|
||||||
|
|
||||||
logCipherText bool // somewhat expensive, for debugging
|
logCipherText bool // somewhat expensive, for debugging
|
||||||
logPlainText bool // INSECURE and somewhat expensive, for debugging
|
logPlainText bool // INSECURE and somewhat expensive, for debugging
|
||||||
|
@ -139,10 +138,6 @@ func (hc *Conn) SetStatus(stat CSOType) {
|
||||||
log.Println("closeStat:", *hc.closeStat)
|
log.Println("closeStat:", *hc.closeStat)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hc *Conn) SetImmClose() {
|
|
||||||
hc.immClose = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// ConnOpts returns the cipher/hmac options value, which is sent to the
|
// ConnOpts returns the cipher/hmac options value, which is sent to the
|
||||||
// peer but is not itself part of the KEx.
|
// peer but is not itself part of the KEx.
|
||||||
//
|
//
|
||||||
|
@ -764,13 +759,7 @@ func (hc *Conn) Close() (err error) {
|
||||||
log.Printf("** Writing closeStat %d at Close()\n", *hc.closeStat)
|
log.Printf("** Writing closeStat %d at Close()\n", *hc.closeStat)
|
||||||
//(*hc.c).SetWriteDeadline(time.Now().Add(500 * time.Millisecond))
|
//(*hc.c).SetWriteDeadline(time.Now().Add(500 * time.Millisecond))
|
||||||
hc.WritePacket(s, CSOExitStatus)
|
hc.WritePacket(s, CSOExitStatus)
|
||||||
// This avoids a bug where server side may not get its last packet of
|
err = (*hc.c).Close()
|
||||||
// data through to a client for non-interactive commands which exit
|
|
||||||
// immediately. Avoiding the immediate close lets the client close its
|
|
||||||
// side first.
|
|
||||||
if hc.immClose {
|
|
||||||
err = (*hc.c).Close()
|
|
||||||
}
|
|
||||||
logger.LogDebug(fmt.Sprintln("[Conn Closing]"))
|
logger.LogDebug(fmt.Sprintln("[Conn Closing]"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1084,7 +1073,6 @@ func (hc Conn) Read(b []byte) (n int, err error) {
|
||||||
logger.LogDebug(fmt.Sprintln("[truncated payload, cannot determine CSOExitStatus]"))
|
logger.LogDebug(fmt.Sprintln("[truncated payload, cannot determine CSOExitStatus]"))
|
||||||
hc.SetStatus(CSETruncCSO)
|
hc.SetStatus(CSETruncCSO)
|
||||||
}
|
}
|
||||||
hc.SetImmClose() // clients can immediately close their end
|
|
||||||
hc.Close()
|
hc.Close()
|
||||||
} else if ctrlStatOp == CSOTunSetup {
|
} else if ctrlStatOp == CSOTunSetup {
|
||||||
// server side tunnel setup in response to client
|
// server side tunnel setup in response to client
|
||||||
|
|
|
@ -406,7 +406,9 @@ func runShellAs(who, hname, ttype, cmd string, interactive bool, conn *hkexnet.C
|
||||||
// Background jobs still may be running; close the
|
// Background jobs still may be running; close the
|
||||||
// pty anyway, so the client can return before
|
// pty anyway, so the client can return before
|
||||||
// wg.Wait() below completes (Issue #18)
|
// wg.Wait() below completes (Issue #18)
|
||||||
_ = ptmx.Close()
|
if interactive {
|
||||||
|
_ = ptmx.Close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
wg.Wait() // Wait on pty->stdout completion to client
|
wg.Wait() // Wait on pty->stdout completion to client
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue