TCP ports use lots

This commit is contained in:
Zack Scholl 2018-09-25 17:18:43 -07:00
parent ec5d45307a
commit 71fee31da0
2 changed files with 3 additions and 6 deletions

View File

@ -292,7 +292,6 @@ func receive(forceSend int, serverAddress string, tcpPorts []string, isLocal boo
dataChan <- message
}
}
_ = <-finished
} else {
log.Debugf("starting listening with tcp with %d connections", len(tcpConnections))
// using TCP
@ -324,8 +323,7 @@ func receive(forceSend int, serverAddress string, tcpPorts []string, isLocal boo
}
_ = <-finished
log.Debug("finished")
log.Debug("telling sender i'm done")
c.WriteMessage(websocket.BinaryMessage, []byte("done"))
// we are finished
transferTime = time.Since(startTime)

View File

@ -342,10 +342,9 @@ func send(forceSend int, serverAddress string, tcpPorts []string, isLocal bool,
return err
}
if bytes.Equal(data.b, []byte("magic")) {
return
break
}
}
} else {
for i := range tcpConnections {
go func(tcpConnection comm.Comm) {
@ -355,7 +354,6 @@ func send(forceSend int, serverAddress string, tcpPorts []string, isLocal bool,
log.Error(data.err)
return
}
bar.Add(data.bytesRead)
// write data to tcp connection
_, err = tcpConnection.Write(data.b)
@ -383,6 +381,7 @@ func send(forceSend int, serverAddress string, tcpPorts []string, isLocal bool,
case 5:
transferTime := time.Since(startTransfer)
if !bytes.HasPrefix(message, []byte("hash:")) {
log.Debugf("%s", message)
continue
}
c.WriteMessage(websocket.BinaryMessage, fileHash)