]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/toss.go
NNCPNOSYNC environment variable
[nncp.git] / src / toss.go
index bdfcb31aad6d4ec44b0cc18dd17df32ce0ad4dde..e383257db77c43e31ddd8127160276526376983e 100644 (file)
@@ -329,16 +329,18 @@ func jobProcess(
                                })
                                return err
                        }
-                       if err = tmp.Sync(); err != nil {
-                               tmp.Close()
-                               ctx.LogE("rx-sync", les, err, func(les LEs) string {
-                                       return fmt.Sprintf(
-                                               "Tossing file %s/%s (%s): %s: syncing",
-                                               sender.Name, pktName,
-                                               humanize.IBytes(pktSize), dst,
-                                       )
-                               })
-                               return err
+                       if !NoSync {
+                               if err = tmp.Sync(); err != nil {
+                                       tmp.Close()
+                                       ctx.LogE("rx-sync", les, err, func(les LEs) string {
+                                               return fmt.Sprintf(
+                                                       "Tossing file %s/%s (%s): %s: syncing",
+                                                       sender.Name, pktName,
+                                                       humanize.IBytes(pktSize), dst,
+                                               )
+                                       })
+                                       return err
+                               }
                        }
                        if err = tmp.Close(); err != nil {
                                ctx.LogE("rx-close", les, err, func(les LEs) string {