Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support set deadline for qmp socket connection #206

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions qmp/socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ func (mon *SocketMonitor) Events(context.Context) (<-chan Event, error) {
return mon.events, nil
}

// SetRWDeadline sets the read and write deadlines for the underlying socket.
// Set deadline to prevent the Command from hanging due to other processes
// (e.g. libvirt) occupying the QEMU monitor socket.
func (mon *SocketMonitor) SetRWDeadline(t time.Time) error {
return mon.c.SetDeadline(t)
}

// listen listens for incoming data from a QEMU monitor socket. It determines
// if the data is an asynchronous event or a response to a command, and returns
// the data on the appropriate channel.
Expand Down