diff --git a/client.go b/client.go index e343282..38ec886 100644 --- a/client.go +++ b/client.go @@ -182,7 +182,7 @@ func (p *Client) AcceptTcp() error { loggo.Info("client waiting local accept tcp") for { - p.tcplistenConn.SetDeadline(time.Now().Add(time.Millisecond * 100)) + p.tcplistenConn.SetDeadline(time.Now().Add(time.Millisecond * 1000)) conn, err := p.tcplistenConn.AcceptTCP() if err != nil { @@ -193,7 +193,9 @@ func (p *Client) AcceptTcp() error { } } - go p.AcceptTcpConn(conn) + if conn != nil { + go p.AcceptTcpConn(conn) + } } } @@ -240,8 +242,8 @@ func (p *Client) AcceptTcpConn(conn *net.TCPConn) { for e := sendlist.Front(); e != nil; e = e.Next() { - f := e.Value.(Frame) - mb, err := proto.Marshal(&f) + f := e.Value.(*Frame) + mb, err := proto.Marshal(f) if err != nil { loggo.Error("Error tcp Marshal %s %s %s", uuid, tcpsrcaddr.String(), err) continue diff --git a/server.go b/server.go index d4b333c..72906a9 100644 --- a/server.go +++ b/server.go @@ -208,8 +208,8 @@ func (p *Server) RecvTCP(conn *ServerConn, id string, src *net.IPAddr) { for e := sendlist.Front(); e != nil; e = e.Next() { - f := e.Value.(Frame) - mb, err := proto.Marshal(&f) + f := e.Value.(*Frame) + mb, err := proto.Marshal(f) if err != nil { loggo.Error("Error tcp Marshal %s %s %s", conn.id, conn.tcpaddrTarget.String(), err) continue