MCPcopy Create free account
hub / github.com/CPChain/chain / ipcTestClient

Function ipcTestClient

api/rpc/client_test.go:521–545  ·  view source on GitHub ↗
(srv *Server, fl *flakeyListener)

Source from the content-addressed store, hash-verified

519}
520
521func 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.
548type flakeyListener struct {

Callers 1

testClientCancelFunction · 0.85

Calls 3

ServeListenerMethod · 0.80
ipcListenFunction · 0.70
DialFunction · 0.70

Tested by

no test coverage detected