mirror of
https://github.com/schollz/croc.git
synced 2024-11-28 09:35:14 +03:00
TCP ports use lots
This commit is contained in:
parent
ec5d45307a
commit
71fee31da0
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user