aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-12-12 23:14:55 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2016-12-12 23:14:55 +0100
commit920dc0253f2d4e00779ed895d06a7a72e0e8ab66 (patch)
treed64f4a56912e0e4e2078d8f82cee454492d0993e /plumbing/transport
parent6bea9df0e0075ab67cd3ae549489890db4709f0b (diff)
downloadgo-git-920dc0253f2d4e00779ed895d06a7a72e0e8ab66.tar.gz
transport/git: fix pktline encode and timeout
Diffstat (limited to 'plumbing/transport')
-rw-r--r--plumbing/transport/git/common.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/plumbing/transport/git/common.go b/plumbing/transport/git/common.go
index a68b7df..8c35c19 100644
--- a/plumbing/transport/git/common.go
+++ b/plumbing/transport/git/common.go
@@ -6,7 +6,6 @@ import (
"io"
"net"
"strings"
- "time"
"gopkg.in/src-d/go-git.v4/plumbing/format/pktline"
"gopkg.in/src-d/go-git.v4/plumbing/transport"
@@ -48,13 +47,9 @@ func (c *command) SetAuth(auth transport.AuthMethod) error {
// Start executes the command sending the required message to the TCP connection
func (c *command) Start() error {
cmd := endpointToCommand(c.command, c.endpoint)
- line, err := pktline.EncodeFromString(cmd)
- if err != nil {
- return err
- }
- _, err = c.conn.Write([]byte(line))
- return err
+ e := pktline.NewEncoder(c.conn)
+ return e.Encode([]byte(cmd))
}
func (c *command) connect() error {
@@ -63,7 +58,7 @@ func (c *command) connect() error {
}
var err error
- c.conn, err = net.DialTimeout("tcp", c.getHostWithPort(), time.Second)
+ c.conn, err = net.Dial("tcp", c.getHostWithPort())
if err != nil {
return err
}