mirror of https://github.com/schollz/croc.git
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")
|
fmt.Fprintf(c.App.Writer, "lipstick\nkiss\nme\nlipstick\nringo\n")
|
||||||
}
|
}
|
||||||
app.Action = func(c *cli.Context) error {
|
app.Action = func(c *cli.Context) error {
|
||||||
return cr.Receive(c.Args().First())
|
return receive(c)
|
||||||
}
|
}
|
||||||
app.Before = func(c *cli.Context) error {
|
app.Before = func(c *cli.Context) error {
|
||||||
cr = croc.Init()
|
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
|
// Receive will receive something through the croc relay
|
||||||
func (c *Croc) Receive(codePhrase string) (err error) {
|
func (c *Croc) Receive(codePhrase string) (err error) {
|
||||||
defer c.cleanup()
|
defer c.cleanup()
|
||||||
|
log.Debugf("receiving with code phrase: %s", codePhrase)
|
||||||
if !c.NoLocal {
|
if !c.NoLocal {
|
||||||
// try to discovery codephrase and server through peer network
|
// try to discovery codephrase and server through peer network
|
||||||
discovered, errDiscover := peerdiscovery.Discover(peerdiscovery.Settings{
|
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
|
// open encrypted file chunk, if it exists
|
||||||
log.Debug("opening encrypted file chunk: " + filename)
|
log.Debug("opening encrypted file chunk: " + filename)
|
||||||
|
defer os.Remove(filename)
|
||||||
file, err := os.Open(filename)
|
file, err := os.Open(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
|
|
Loading…
Reference in New Issue