func (c *VirConnection) CloseConnection() (int, error) { result := int(C.virConnectClose(c.ptr)) if result == -1 { return result, GetLastError() } return result, nil }
func (c *VirConnection) CloseConnection() error { result := int(C.virConnectClose(c.ptr)) if result == -1 { return errors.New(GetLastError()) } return nil }
func (c *VirConnection) CloseConnection() (int, error) { result := int(C.virConnectClose(c.ptr)) if result == -1 { return result, GetLastError() } // Cleaup callbacks c.event_cbs = make(map[int]*domainCallbackContext) return result, nil }
func (c *VirConnection) CloseConnection() (int, error) { c.UnsetErrorFunc() result := int(C.virConnectClose(c.ptr)) if result == -1 { return result, GetLastError() } if result == 0 { // No more reference to this connection, release data. releaseConnectionData(c) } return result, nil }
func (h *Hypervisor) CloseConnection() error { result := C.virConnectClose(h.cptr) defer func() { h.cptr = nil }() if result == -1 { return GetLastError() } return nil }
// Close closes the connection to the Hypervisor. Connections are reference // counted; the count is explicitly increased by the initial open (Open, // OpenAuth, and the like) as well as Ref (not implemented yet); it is also // temporarily increased by other API that depend on the connection remaining // alive. The open and every Ref call should have a matching Close, and all // other references will be released after the corresponding operation // completes. // It returns a positive number if at least 1 reference remains on success. The // returned value should not be assumed to be the total reference count. A // return of 0 implies no references remain and the connection is closed and // memory has been freed. It is possible for the last Close to return a // positive value if some other object still has a temporary reference to the // connection, but the application should not try to further use a connection // after the Close that matches the initial open. func (conn Connection) Close() (int32, error) { conn.log.Println("closing connection...") cRet := C.virConnectClose(conn.virConnect) ret := int32(cRet) if ret == -1 { err := LastError() conn.log.Printf("an error occurred: %v\n", err) return 0, err } conn.log.Printf("connection closed; remaining references: %v\n", ret) return ret, nil }