slirp/tcp_subr.c: fix coding style in tcp_connect
Fix coding style in tcp_connect before the next patch. Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
2c20e711de
commit
4ef7b8944c
@ -384,8 +384,7 @@ int tcp_fconnect(struct socket *so)
|
||||
* the time it gets to accept(), so... We simply accept
|
||||
* here and SYN the local-host.
|
||||
*/
|
||||
void
|
||||
tcp_connect(struct socket *inso)
|
||||
void tcp_connect(struct socket *inso)
|
||||
{
|
||||
Slirp *slirp = inso->slirp;
|
||||
struct socket *so;
|
||||
@ -405,7 +404,8 @@ tcp_connect(struct socket *inso)
|
||||
/* FACCEPTONCE already have a tcpcb */
|
||||
so = inso;
|
||||
} else {
|
||||
if ((so = socreate(slirp)) == NULL) {
|
||||
so = socreate(slirp);
|
||||
if (so == NULL) {
|
||||
/* If it failed, get rid of the pending connection */
|
||||
closesocket(accept(inso->s, (struct sockaddr *)&addr, &addrlen));
|
||||
return;
|
||||
@ -418,9 +418,10 @@ tcp_connect(struct socket *inso)
|
||||
so->so_lport = inso->so_lport;
|
||||
}
|
||||
|
||||
(void) tcp_mss(sototcpcb(so), 0);
|
||||
tcp_mss(sototcpcb(so), 0);
|
||||
|
||||
if ((s = accept(inso->s,(struct sockaddr *)&addr,&addrlen)) < 0) {
|
||||
s = accept(inso->s, (struct sockaddr *)&addr, &addrlen);
|
||||
if (s < 0) {
|
||||
tcp_close(sototcpcb(so)); /* This will sofree() as well */
|
||||
return;
|
||||
}
|
||||
@ -443,9 +444,12 @@ tcp_connect(struct socket *inso)
|
||||
|
||||
/* Close the accept() socket, set right state */
|
||||
if (inso->so_state & SS_FACCEPTONCE) {
|
||||
closesocket(so->s); /* If we only accept once, close the accept() socket */
|
||||
so->so_state = SS_NOFDREF; /* Don't select it yet, even though we have an FD */
|
||||
/* If we only accept once, close the accept() socket */
|
||||
closesocket(so->s);
|
||||
|
||||
/* Don't select it yet, even though we have an FD */
|
||||
/* if it's not FACCEPTONCE, it's already NOFDREF */
|
||||
so->so_state = SS_NOFDREF;
|
||||
}
|
||||
so->s = s;
|
||||
so->so_state |= SS_INCOMING;
|
||||
|
Loading…
x
Reference in New Issue
Block a user