提交 c2255287 编写于 作者: H Helin Wang

fix cgo example

上级 1e5795b8
...@@ -100,7 +100,7 @@ func (l lister) List() []pserver.Server { ...@@ -100,7 +100,7 @@ func (l lister) List() []pserver.Server {
} }
//export paddle_new_pserver_client //export paddle_new_pserver_client
func paddle_new_pserver_client(addrs *C.char, selected bool) C.client { func paddle_new_pserver_client(addrs *C.char, selected int) C.client {
a := C.GoString(addrs) a := C.GoString(addrs)
as := strings.Split(a, ",") as := strings.Split(a, ",")
servers := make([]pserver.Server, len(as)) servers := make([]pserver.Server, len(as))
...@@ -108,7 +108,7 @@ func paddle_new_pserver_client(addrs *C.char, selected bool) C.client { ...@@ -108,7 +108,7 @@ func paddle_new_pserver_client(addrs *C.char, selected bool) C.client {
servers[i].Index = i servers[i].Index = i
servers[i].Addr = as[i] servers[i].Addr = as[i]
} }
c := pserver.NewClient(lister(servers), len(as), selector(selected)) c := pserver.NewClient(lister(servers), len(as), selector(selected != 0))
return add(c) return add(c)
} }
......
...@@ -11,9 +11,9 @@ void fail() { ...@@ -11,9 +11,9 @@ void fail() {
int main() { int main() {
char addr[] = "localhost:3000"; char addr[] = "localhost:3000";
client c = paddle_new_pserver_client(addr); client c = paddle_new_pserver_client(addr, 1);
retry: retry:
if (paddle_begin_init_params(c, NULL, 0)) { if (paddle_begin_init_params(c)) {
paddle_parameter param; paddle_parameter param;
char name_a[] = "param_a"; char name_a[] = "param_a";
char name_b[] = "param_b"; char name_b[] = "param_b";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册