Commit 6db0fdce authored by Anthony Liguori's avatar Anthony Liguori
Browse files

Revert 455aa1e0 and c3767ed0



    commit c3767ed0
    qemu-char: (Re-)connect for tcp_chr_write() unconnected writing

Has no hope of working because tcp_chr_connect() does not actually connect.

455aa1e0 just fixes the SEGV with server() but the attempt to connect a client
socket is still completely broken.

This patch reverts both.

Reported-by: default avatarRichard W.M. Jones <rjones@redhat.com>
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
parent ed0ec1aa
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -2141,18 +2141,13 @@ typedef struct {

static void tcp_chr_accept(void *opaque);

static void tcp_chr_connect(void *opaque);

static int tcp_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
{
    TCPCharDriver *s = chr->opaque;
    if (s->connected) {
        return send_all(s->fd, buf, len);
    } else if (s->listen_fd == -1) {
        /* (Re-)connect for unconnected writing */
        tcp_chr_connect(chr);
        return 0;
    } else {
        /* XXX: indicate an error ? */
        return len;
    }
}