mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
Simplified UI
This commit is contained in:
parent
ab434a8955
commit
2001e13057
1 changed files with 8 additions and 6 deletions
10
connect.go
10
connect.go
|
@ -293,6 +293,7 @@ func (c *Connection) runClient() error {
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
// Write data from file
|
// Write data from file
|
||||||
logger.Debug("send file")
|
logger.Debug("send file")
|
||||||
|
startTime = time.Now()
|
||||||
if err := c.sendFile(id, connection); err != nil {
|
if err := c.sendFile(id, connection); err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
}
|
}
|
||||||
|
@ -386,6 +387,7 @@ func (c *Connection) runClient() error {
|
||||||
if id == 0 {
|
if id == 0 {
|
||||||
fmt.Printf("\n\nReceiving (<-%s)..\n", sendersAddress)
|
fmt.Printf("\n\nReceiving (<-%s)..\n", sendersAddress)
|
||||||
}
|
}
|
||||||
|
startTime = time.Now()
|
||||||
if err := c.receiveFile(id, connection); err != nil {
|
if err := c.receiveFile(id, connection); err != nil {
|
||||||
log.Error(errors.Wrap(err, "Problem receiving the file: "))
|
log.Error(errors.Wrap(err, "Problem receiving the file: "))
|
||||||
}
|
}
|
||||||
|
@ -407,7 +409,7 @@ func (c *Connection) runClient() error {
|
||||||
fmt.Println("Timeout waiting for receiver")
|
fmt.Println("Timeout waiting for receiver")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
fmt.Println("\nFile sent.")
|
fmt.Print("\nFile sent")
|
||||||
} else { // Is a Receiver
|
} else { // Is a Receiver
|
||||||
if responses.notPresent {
|
if responses.notPresent {
|
||||||
fmt.Println("Sender is not ready. Use -wait to wait until sender connects.")
|
fmt.Println("Sender is not ready. Use -wait to wait until sender connects.")
|
||||||
|
@ -462,13 +464,13 @@ func (c *Connection) runClient() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Printf("\nReceived folder written to %s\n", path.Join(c.Path, c.File.Name[:len(c.File.Name)-4]))
|
fmt.Printf("\nReceived folder written to %s", path.Join(c.Path, c.File.Name[:len(c.File.Name)-4]))
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("\nReceived file written to %s\n", path.Join(c.Path, c.File.Name))
|
fmt.Printf("\nReceived file written to %s", path.Join(c.Path, c.File.Name))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
timeSinceStart := time.Since(startTime) / time.Second
|
timeSinceStart := time.Since(startTime) / time.Second
|
||||||
fmt.Printf("\nTransfered at an average speed of %s/s", humanize.Bytes(uint64(float64(c.File.Size)/float64(timeSinceStart))))
|
fmt.Printf(" (%s/s)\n", humanize.Bytes(uint64(float64(c.File.Size)/float64(timeSinceStart))))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue