RPC is used to make an RPC call to a remote host
(addr net.Addr, method string, args interface{}, reply interface{})
| 323 | |
| 324 | // RPC is used to make an RPC call to a remote host |
| 325 | func (p *connPool) RPC(addr net.Addr, method string, args interface{}, reply interface{}) error { |
| 326 | // Get a usable client |
| 327 | conn, sc, err := p.getClient(addr) |
| 328 | if err != nil { |
| 329 | return fmt.Errorf("rpc error: %v", err) |
| 330 | } |
| 331 | |
| 332 | // Make the RPC call |
| 333 | err = msgpackrpc.CallWithCodec(sc.codec, method, args, reply) |
| 334 | if err != nil { |
| 335 | sc.Close() |
| 336 | p.releaseConn(conn) |
| 337 | return fmt.Errorf("rpc error: %v", err) |
| 338 | } |
| 339 | |
| 340 | // Done with the connection |
| 341 | conn.returnClient(sc) |
| 342 | p.releaseConn(conn) |
| 343 | return nil |
| 344 | } |
| 345 | |
| 346 | // Reap is used to close conns open over maxTime |
| 347 | func (p *connPool) reap() { |
no test coverage detected