| 38 | } |
| 39 | |
| 40 | func combine(o1 []CallOption, o2 []CallOption) []CallOption { |
| 41 | // we don't use append because o1 could have extra capacity whose |
| 42 | // elements would be overwritten, which could cause inadvertent |
| 43 | // sharing (and race conditions) between concurrent calls |
| 44 | if len(o1) == 0 { |
| 45 | return o2 |
| 46 | } else if len(o2) == 0 { |
| 47 | return o1 |
| 48 | } |
| 49 | ret := make([]CallOption, len(o1)+len(o2)) |
| 50 | copy(ret, o1) |
| 51 | copy(ret[len(o1):], o2) |
| 52 | return ret |
| 53 | } |
| 54 | |
| 55 | // Invoke sends the RPC request on the wire and returns after response is |
| 56 | // received. This is typically called by generated code. |