Displaying 4 results from an estimated 4 matches for "virstreamsend".
2013 Sep 19
2
Re: Trouble using virStream with callbacks
On Thu, Sep 19, 2013 at 11:59:45AM -0400, Jonathan Lebon wrote:
> I tried to dig a bit deeper in this. From my limited understanding,
> it seems like stream events are implemented as enabled/disabled timers.
> The issue is that if there's no data from the guest app pending, the
> timeout in virEventPollRunOnce will be calculated as -1. So then we
> block on the poll() and only
2013 Sep 19
0
Re: Trouble using virStream with callbacks
...ou
> aren't putting it into raw mode like virsh console does. This will
> delay I/O on the stdio streams.
That's a good point. But since all the messages between host and guest end
in newlines, that shouldn't be an issue, right? Anyway, I can see the lines
from stdin making it to virStreamSend() upon the first <Enter>. And from the
other side, it's safe to assume socat sends the data after the first <Enter>
as well (since it works fine with socat to socat directly on the socket/port).
Thanks,
Jonathan
2013 Sep 19
2
Re: Trouble using virStream with callbacks
...g it into raw mode like virsh console does. This will
> > delay I/O on the stdio streams.
>
> That's a good point. But since all the messages between host and guest end
> in newlines, that shouldn't be an issue, right? Anyway, I can see the lines
> from stdin making it to virStreamSend() upon the first <Enter>. And from the
> other side, it's safe to assume socat sends the data after the first <Enter>
> as well (since it works fine with socat to socat directly on the socket/port).
As a test why not try hacking virsh console so that it connects to your
virti...
2013 Sep 18
2
Trouble using virStream with callbacks
...tream_active = 1;
void
stdin_to_stream(int watch, int fd, int events, void *opaque)
{
virStreamPtr stream = *((virStreamPtr*)(opaque));
if (events & VIR_EVENT_HANDLE_READABLE) {
char buf[1024];
int bytes_read = read(fd, buf, sizeof(buf));
if (bytes_read > 0)
virStreamSend(stream, buf, bytes_read);
}
if (events & (VIR_EVENT_HANDLE_ERROR|VIR_EVENT_HANDLE_HANGUP)) {
stream_active = 0;
}
return;
}
void
stream_to_stdout(virStreamPtr stream, int events, void *opaque)
{
if (events & VIR_EVENT_HANDLE_READABLE) {
char buf[1024];
int...