uip: finish off the changes for connect()

A connect that fails is now echoed back to the guest with a valid RST frame
so that the client user sees "connection refused" not a long timeout and
failure.
This commit is contained in:
Alan
2015-04-01 22:00:09 +01:00
committed by Dimitri John Ledkov
parent fccb7a1553
commit 77f6ea83ae
+3 -2
View File
@@ -161,8 +161,9 @@ static struct uip_tcp_socket *uip_tcp_socket_alloc(struct uip_tx_arg *arg, u32 s
ret = connect(sk->fd, (struct sockaddr *)&sk->addr, sizeof(sk->addr));
if (ret) {
perror("connect");
uip_tcp_payload_send(sk, UIP_TCP_FLAG_RST, 0);
sk->ack_server = ntohl(tcp->seq) + 1;
sk->seq_server = 0;
uip_tcp_payload_send(sk, UIP_TCP_FLAG_RST|UIP_TCP_FLAG_ACK, 0);
free(sk);
return NULL;
}