Make DialTimeout configurable.

This commit is contained in:
NI
2019-08-12 23:50:24 +08:00
parent db633f59bd
commit f3336d61a0
17 changed files with 173 additions and 119 deletions

View File

@@ -25,7 +25,6 @@ import (
"testing"
"github.com/niruix/sshwifty/application/log"
"github.com/niruix/sshwifty/application/network"
"github.com/niruix/sshwifty/application/rw"
)
@@ -58,7 +57,7 @@ func testDummyFetchChainGen(dd <-chan []byte) rw.FetchReaderFetcher {
}
type dummyStreamCommand struct {
lock sync.Mutex
lock sync.Mutex
l log.Logger
w StreamResponder
downWait sync.WaitGroup
@@ -67,9 +66,12 @@ type dummyStreamCommand struct {
}
func newDummyStreamCommand(
l log.Logger, w StreamResponder, d network.Dial) FSMMachine {
l log.Logger,
w StreamResponder,
cfg CommandConfiguration,
) FSMMachine {
return &dummyStreamCommand{
lock:sync.Mutex{},
lock: sync.Mutex{},
l: l,
w: w,
downWait: sync.WaitGroup{},
@@ -84,7 +86,7 @@ func (d *dummyStreamCommand) Bootup(
) (FSMState, FSMError) {
d.downWait.Add(1)
echoTrans:=d.echoTrans
echoTrans := d.echoTrans
go func() {
defer func() {
@@ -178,7 +180,7 @@ func TestHandlerHandleStream(t *testing.T) {
lock := sync.Mutex{}
hhd := newHandler(
nil,
CommandConfiguration{},
&cmds,
rw.NewFetchReader(readerSource),
wBuffer,