Commit cc8fb739 authored by Daniel P. Berrange's avatar Daniel P. Berrange

Fix connect callback to take *Connect instead of Connect

All methods should take pointers to the main objects
Signed-off-by: default avatarDaniel P. Berrange <berrange@redhat.com>
parent 1dfd5832
......@@ -422,7 +422,7 @@ func (c *Connect) Close() (int, error) {
return result, nil
}
type CloseCallback func(conn Connect, reason ConnectCloseReason)
type CloseCallback func(conn *Connect, reason ConnectCloseReason)
// Register a close callback for the given destination. Only one
// callback per connection is allowed. Setting a callback will remove
......@@ -462,7 +462,7 @@ func closeCallback(conn C.virConnectPtr, reason ConnectCloseReason, goCallbackId
if !ok {
panic("Inappropriate callback type called")
}
callback(Connect{ptr: conn}, reason)
callback(&Connect{ptr: conn}, reason)
}
func (c *Connect) GetCapabilities() (string, error) {
......
......@@ -140,27 +140,27 @@ func TestMultipleCloseCallback(t *testing.T) {
}
}()
callback := func(conn Connect, reason ConnectCloseReason) {
callback := func(conn *Connect, reason ConnectCloseReason) {
if reason != CONNECT_CLOSE_REASON_KEEPALIVE {
t.Errorf("Expected close reason to be %d, got %d",
CONNECT_CLOSE_REASON_KEEPALIVE, reason)
}
}
err := conn.RegisterCloseCallback(func(conn Connect, reason ConnectCloseReason) {
err := conn.RegisterCloseCallback(func(conn *Connect, reason ConnectCloseReason) {
callback(conn, reason)
nbCall1++
})
if err != nil {
t.Fatalf("Unable to register close callback: %+v", err)
}
err = conn.RegisterCloseCallback(func(conn Connect, reason ConnectCloseReason) {
err = conn.RegisterCloseCallback(func(conn *Connect, reason ConnectCloseReason) {
callback(conn, reason)
nbCall2++
})
if err != nil {
t.Fatalf("Unable to register close callback: %+v", err)
}
err = conn.RegisterCloseCallback(func(conn Connect, reason ConnectCloseReason) {
err = conn.RegisterCloseCallback(func(conn *Connect, reason ConnectCloseReason) {
callback(conn, reason)
nbCall3++
})
......@@ -189,7 +189,7 @@ func TestUnregisterCloseCallback(t *testing.T) {
}
}()
callback := func(conn Connect, reason ConnectCloseReason) {
callback := func(conn *Connect, reason ConnectCloseReason) {
nbCall++
}
err := conn.RegisterCloseCallback(callback)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment