(srv *Server, fl *flakeyListener)
| 519 | } |
| 520 | |
| 521 | func ipcTestClient(srv *Server, fl *flakeyListener) (*Client, net.Listener) { |
| 522 | // Listen on a random endpoint. |
| 523 | endpoint := fmt.Sprintf("go-ethereum-test-ipc-%d-%d", os.Getpid(), rand.Int63()) |
| 524 | if runtime.GOOS == "windows" { |
| 525 | endpoint = `\\.\pipe\` + endpoint |
| 526 | } else { |
| 527 | endpoint = os.TempDir() + "/" + endpoint |
| 528 | } |
| 529 | l, err := ipcListen(endpoint) |
| 530 | if err != nil { |
| 531 | panic(err) |
| 532 | } |
| 533 | // Connect the listener to the server. |
| 534 | if fl != nil { |
| 535 | fl.Listener = l |
| 536 | l = fl |
| 537 | } |
| 538 | go srv.ServeListener(l) |
| 539 | // Connect the client. |
| 540 | client, err := Dial(endpoint) |
| 541 | if err != nil { |
| 542 | panic(err) |
| 543 | } |
| 544 | return client, l |
| 545 | } |
| 546 | |
| 547 | // flakeyListener kills accepted connections after a random timeout. |
| 548 | type flakeyListener struct { |
no test coverage detected