]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/toss_test.go
Multicast areas
[nncp.git] / src / toss_test.go
index a66f43ba52ae2ea1a761ff663dad3e5aed3001e6..deb70f13d04553e1688daecd80e08206b510e1ea 100644 (file)
@@ -100,6 +100,7 @@ func TestTossExec(t *testing.T) {
                                1<<15,
                                false,
                                false,
+                               nil,
                        ); err != nil {
                                t.Error(err)
                                return false
@@ -112,13 +113,15 @@ func TestTossExec(t *testing.T) {
                        if len(dirFiles(rxPath)) == 0 {
                                continue
                        }
-                       ctx.Toss(ctx.Self.Id, DefaultNiceExec-1, false, false, false, false, false, false)
+                       ctx.Toss(ctx.Self.Id, TRx, DefaultNiceExec-1,
+                               false, false, false, false, false, false, false)
                        if len(dirFiles(rxPath)) == 0 {
                                return false
                        }
                        ctx.Neigh[*nodeOur.Id].Exec = make(map[string][]string)
                        ctx.Neigh[*nodeOur.Id].Exec[handle] = []string{"/bin/sh", "-c", "false"}
-                       ctx.Toss(ctx.Self.Id, DefaultNiceExec, false, false, false, false, false, false)
+                       ctx.Toss(ctx.Self.Id, TRx, DefaultNiceExec,
+                               false, false, false, false, false, false, false)
                        if len(dirFiles(rxPath)) == 0 {
                                return false
                        }
@@ -130,7 +133,8 @@ func TestTossExec(t *testing.T) {
                                        filepath.Join(spool, "mbox"),
                                ),
                        }
-                       ctx.Toss(ctx.Self.Id, DefaultNiceExec, false, false, false, false, false, false)
+                       ctx.Toss(ctx.Self.Id, TRx, DefaultNiceExec,
+                               false, false, false, false, false, false, false)
                        if len(dirFiles(rxPath)) != 0 {
                                return false
                        }
@@ -204,6 +208,7 @@ func TestTossFile(t *testing.T) {
                                MaxFileSize,
                                1<<15,
                                MaxFileSize,
+                               nil,
                        ); err != nil {
                                t.Error(err)
                                return false
@@ -211,12 +216,14 @@ func TestTossFile(t *testing.T) {
                }
                rxPath := filepath.Join(spool, ctx.Self.Id.String(), string(TRx))
                os.Rename(filepath.Join(spool, ctx.Self.Id.String(), string(TTx)), rxPath)
-               ctx.Toss(ctx.Self.Id, DefaultNiceFile, false, false, false, false, false, false)
+               ctx.Toss(ctx.Self.Id, TRx, DefaultNiceFile,
+                       false, false, false, false, false, false, false)
                if len(dirFiles(rxPath)) == 0 {
                        return false
                }
                ctx.Neigh[*nodeOur.Id].Incoming = &incomingPath
-               ctx.Toss(ctx.Self.Id, DefaultNiceFile, false, false, false, false, false, false)
+               ctx.Toss(ctx.Self.Id, TRx, DefaultNiceFile,
+                       false, false, false, false, false, false, false)
                if len(dirFiles(rxPath)) != 0 {
                        return false
                }
@@ -281,6 +288,7 @@ func TestTossFileSameName(t *testing.T) {
                                MaxFileSize,
                                1<<15,
                                MaxFileSize,
+                               nil,
                        ); err != nil {
                                t.Error(err)
                                return false
@@ -289,7 +297,8 @@ func TestTossFileSameName(t *testing.T) {
                rxPath := filepath.Join(spool, ctx.Self.Id.String(), string(TRx))
                os.Rename(filepath.Join(spool, ctx.Self.Id.String(), string(TTx)), rxPath)
                ctx.Neigh[*nodeOur.Id].Incoming = &incomingPath
-               ctx.Toss(ctx.Self.Id, DefaultNiceFile, false, false, false, false, false, false)
+               ctx.Toss(ctx.Self.Id, TRx, DefaultNiceFile,
+                       false, false, false, false, false, false, false)
                expected := make(map[string]struct{})
                expected["samefile"] = struct{}{}
                for i := 0; i < files-1; i++ {
@@ -360,12 +369,14 @@ func TestTossFreq(t *testing.T) {
                txPath := filepath.Join(spool, ctx.Self.Id.String(), string(TTx))
                os.Rename(txPath, rxPath)
                os.MkdirAll(txPath, os.FileMode(0700))
-               ctx.Toss(ctx.Self.Id, DefaultNiceFreq, false, false, false, false, false, false)
+               ctx.Toss(ctx.Self.Id, TRx, DefaultNiceFreq,
+                       false, false, false, false, false, false, false)
                if len(dirFiles(txPath)) != 0 || len(dirFiles(rxPath)) == 0 {
                        return false
                }
                ctx.Neigh[*nodeOur.Id].FreqPath = &spool
-               ctx.Toss(ctx.Self.Id, DefaultNiceFreq, false, false, false, false, false, false)
+               ctx.Toss(ctx.Self.Id, TRx, DefaultNiceFreq,
+                       false, false, false, false, false, false, false)
                if len(dirFiles(txPath)) != 0 || len(dirFiles(rxPath)) == 0 {
                        return false
                }
@@ -378,7 +389,8 @@ func TestTossFreq(t *testing.T) {
                                panic(err)
                        }
                }
-               ctx.Toss(ctx.Self.Id, DefaultNiceFreq, false, false, false, false, false, false)
+               ctx.Toss(ctx.Self.Id, TRx, DefaultNiceFreq,
+                       false, false, false, false, false, false, false)
                if len(dirFiles(txPath)) == 0 || len(dirFiles(rxPath)) != 0 {
                        return false
                }
@@ -389,7 +401,7 @@ func TestTossFreq(t *testing.T) {
                                t.Error(err)
                                return false
                        }
-                       _, _, err = PktEncRead(ctx.Self, ctx.Neigh, fd, &buf)
+                       _, _, _, err = PktEncRead(ctx.Self, ctx.Neigh, fd, &buf, true, nil)
                        if err != nil {
                                t.Error(err)
                                return false
@@ -483,7 +495,8 @@ func TestTossTrns(t *testing.T) {
                                panic(err)
                        }
                }
-               ctx.Toss(ctx.Self.Id, 123, false, false, false, false, false, false)
+               ctx.Toss(ctx.Self.Id, TRx, 123,
+                       false, false, false, false, false, false, false)
                if len(dirFiles(rxPath)) != 0 {
                        return false
                }