This commit is contained in:
Zack Scholl 2018-09-26 08:54:01 -07:00
parent c0e9d478e7
commit 73d8eadce4
3 changed files with 14 additions and 4 deletions

View File

@ -3,7 +3,6 @@ package recipient
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net"
@ -14,6 +13,7 @@ import (
"time"
humanize "github.com/dustin/go-humanize"
"github.com/pkg/errors"
log "github.com/cihub/seelog"
"github.com/gorilla/websocket"
@ -407,10 +407,15 @@ func receive(forceSend int, serverAddress string, tcpPorts []string, isLocal boo
func connectToTCPServer(room string, address string) (com *comm.Comm, err error) {
log.Debugf("recipient connecting to %s", address)
connection, err := net.Dial("tcp", address)
rAddr, err := net.ResolveTCPAddr("tcp", address)
if err != nil {
return
}
connection, err := net.DialTCP("tcp", nil, rAddr)
if err != nil {
err = errors.Wrap(err, "bad connection to tcp")
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))

View File

@ -408,10 +408,15 @@ func send(forceSend int, serverAddress string, tcpPorts []string, isLocal bool,
}
func connectToTCPServer(room string, address string) (com *comm.Comm, err error) {
connection, err := net.Dial("tcp", address)
rAddr, err := net.ResolveTCPAddr("tcp", address)
if err != nil {
return
}
connection, err := net.DialTCP("tcp", nil, rAddr)
if err != nil {
err = errors.Wrap(err, "bad connection to tcp")
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))

View File

@ -42,7 +42,7 @@ func Run(debugLevel, port string) {
func run(port string) (err error) {
log.Debugf("starting TCP server on " + port)
rAddr, err := net.ResolveTCPAddr("tcp", "localhost:"+port)
rAddr, err := net.ResolveTCPAddr("tcp", "0.0.0.0:"+port)
if err != nil {
panic(err)
}