Revert 455aa1e08
and c3767ed0eb
commitc3767ed0eb
qemu-char: (Re-)connect for tcp_chr_write() unconnected writing Has no hope of working because tcp_chr_connect() does not actually connect.455aa1e08
just fixes the SEGV with server() but the attempt to connect a client socket is still completely broken. This patch reverts both. Reported-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
ed0ec1aa85
commit
6db0fdce02
|
@ -2141,18 +2141,13 @@ typedef struct {
|
||||||
|
|
||||||
static void tcp_chr_accept(void *opaque);
|
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)
|
static int tcp_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
|
||||||
{
|
{
|
||||||
TCPCharDriver *s = chr->opaque;
|
TCPCharDriver *s = chr->opaque;
|
||||||
if (s->connected) {
|
if (s->connected) {
|
||||||
return send_all(s->fd, buf, len);
|
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 {
|
} else {
|
||||||
|
/* XXX: indicate an error ? */
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue