(t *testing.T)
| 59 | } |
| 60 | |
| 61 | func TestMappingClearAddresses(t *testing.T) { |
| 62 | tmpFile, err := os.CreateTemp("", "syncthing-testConfig-") |
| 63 | if err != nil { |
| 64 | t.Fatal(err) |
| 65 | } |
| 66 | w := config.Wrap(tmpFile.Name(), config.Configuration{}, protocol.LocalDeviceID, events.NoopLogger) |
| 67 | defer os.RemoveAll(tmpFile.Name()) |
| 68 | tmpFile.Close() |
| 69 | |
| 70 | natSvc := NewService(protocol.EmptyDeviceID, w) |
| 71 | // Mock a mapped port; avoids the need to actually map a port |
| 72 | ip := net.ParseIP("192.168.0.1") |
| 73 | m := natSvc.NewMapping(TCP, IPv4Only, ip, 1024) |
| 74 | m.extAddresses["test"] = []Address{{ |
| 75 | IP: ip, |
| 76 | Port: 1024, |
| 77 | }} |
| 78 | // Now try and remove the mapped port; prior to #4829 this deadlocked |
| 79 | natSvc.RemoveMapping(m) |
| 80 | } |
nothing calls this directly
no test coverage detected