mirror of https://github.com/schollz/croc.git
simplify
This commit is contained in:
parent
8dc8783bd4
commit
b9a5f450c5
|
@ -17,13 +17,10 @@ type Comm struct {
|
||||||
|
|
||||||
// NewConnection gets a new comm to a tcp address
|
// NewConnection gets a new comm to a tcp address
|
||||||
func NewConnection(address string) (c Comm, err error) {
|
func NewConnection(address string) (c Comm, err error) {
|
||||||
connection, err := net.DialTimeout("tcp", address, 3*time.Hour)
|
connection, err := net.DialTimeout("tcp", address, 3*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
connection.SetReadDeadline(time.Now().Add(3 * time.Hour))
|
|
||||||
connection.SetDeadline(time.Now().Add(3 * time.Hour))
|
|
||||||
connection.SetWriteDeadline(time.Now().Add(3 * time.Hour))
|
|
||||||
c = New(connection)
|
c = New(connection)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/schollz/croc/src/comm"
|
"github.com/schollz/croc/src/comm"
|
||||||
"github.com/schollz/croc/src/logger"
|
"github.com/schollz/croc/src/logger"
|
||||||
"github.com/schollz/croc/src/models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const TCP_BUFFER_SIZE = 1024 * 64
|
const TCP_BUFFER_SIZE = 1024 * 64
|
||||||
|
|
Loading…
Reference in New Issue