mirror of
https://github.com/schollz/croc.git
synced 2024-11-23 23:54:17 +03:00
remove partially sent files
This commit is contained in:
parent
34d499127d
commit
09a16cacd5
2
main.go
2
main.go
@ -114,7 +114,7 @@ func main() {
|
||||
fmt.Fprintf(c.App.Writer, "lipstick\nkiss\nme\nlipstick\nringo\n")
|
||||
}
|
||||
app.Action = func(c *cli.Context) error {
|
||||
return cr.Receive(c.Args().First())
|
||||
return receive(c)
|
||||
}
|
||||
app.Before = func(c *cli.Context) error {
|
||||
cr = croc.Init()
|
||||
|
@ -133,6 +133,7 @@ func (c *Croc) Send(fname string, codePhrase string) (err error) {
|
||||
// Receive will receive something through the croc relay
|
||||
func (c *Croc) Receive(codePhrase string) (err error) {
|
||||
defer c.cleanup()
|
||||
log.Debugf("receiving with code phrase: %s", codePhrase)
|
||||
if !c.NoLocal {
|
||||
// try to discovery codephrase and server through peer network
|
||||
discovered, errDiscover := peerdiscovery.Discover(peerdiscovery.Settings{
|
||||
|
@ -505,6 +505,7 @@ func (c *Croc) sendFile(filename string, id int, connection net.Conn) error {
|
||||
|
||||
// open encrypted file chunk, if it exists
|
||||
log.Debug("opening encrypted file chunk: " + filename)
|
||||
defer os.Remove(filename)
|
||||
file, err := os.Open(filename)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
|
Loading…
Reference in New Issue
Block a user