From c225528739703cacef12d4d73144a97fc05fe07c Mon Sep 17 00:00:00 2001 From: Helin Wang Date: Tue, 23 May 2017 19:12:30 -0400 Subject: [PATCH] fix cgo example --- go/pserver/cclient/cclient.go | 4 ++-- go/pserver/cclient/test/main.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go/pserver/cclient/cclient.go b/go/pserver/cclient/cclient.go index ac84b993d..0b4aa7980 100644 --- a/go/pserver/cclient/cclient.go +++ b/go/pserver/cclient/cclient.go @@ -100,7 +100,7 @@ func (l lister) List() []pserver.Server { } //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) as := strings.Split(a, ",") servers := make([]pserver.Server, len(as)) @@ -108,7 +108,7 @@ func paddle_new_pserver_client(addrs *C.char, selected bool) C.client { servers[i].Index = 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) } diff --git a/go/pserver/cclient/test/main.c b/go/pserver/cclient/test/main.c index abfb32e56..c14037235 100644 --- a/go/pserver/cclient/test/main.c +++ b/go/pserver/cclient/test/main.c @@ -11,9 +11,9 @@ void fail() { int main() { char addr[] = "localhost:3000"; - client c = paddle_new_pserver_client(addr); + client c = paddle_new_pserver_client(addr, 1); retry: - if (paddle_begin_init_params(c, NULL, 0)) { + if (paddle_begin_init_params(c)) { paddle_parameter param; char name_a[] = "param_a"; char name_b[] = "param_b"; -- GitLab