mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-30 23:35:00 +08:00
natPlainSocketImpl.cc (bind): Don't go to error case when errno not set.
* java/net/natPlainSocketImpl.cc (bind): Don't go to error case when errno not set. (connect): Likewise. (accept): Likewise. (getOption): Likewise. * java/net/natPlainDatagramSocketImpl.cc (bind): Don't go to error case when errno not set. (peek): Likewise. (send): Likewise. (receive): Likewise. (mcastGrp): Likewise. (setOption): Likewise. (getOption): Likewise. From-SVN: r35617
This commit is contained in:
parent
edd71f0f6c
commit
366a0fd804
@ -1,3 +1,19 @@
|
|||||||
|
2000-08-10 Tom Tromey <tromey@cygnus.com>
|
||||||
|
|
||||||
|
* java/net/natPlainSocketImpl.cc (bind): Don't go to error case
|
||||||
|
when errno not set.
|
||||||
|
(connect): Likewise.
|
||||||
|
(accept): Likewise.
|
||||||
|
(getOption): Likewise.
|
||||||
|
* java/net/natPlainDatagramSocketImpl.cc (bind): Don't go to error
|
||||||
|
case when errno not set.
|
||||||
|
(peek): Likewise.
|
||||||
|
(send): Likewise.
|
||||||
|
(receive): Likewise.
|
||||||
|
(mcastGrp): Likewise.
|
||||||
|
(setOption): Likewise.
|
||||||
|
(getOption): Likewise.
|
||||||
|
|
||||||
2000-08-10 Bryce McKinlay <bryce@albatross.co.nz>
|
2000-08-10 Bryce McKinlay <bryce@albatross.co.nz>
|
||||||
John Stracke <francis@ecal.com>
|
John Stracke <francis@ecal.com>
|
||||||
|
|
||||||
|
@ -199,7 +199,8 @@ java::net::PlainDatagramSocketImpl::bind (jint lport,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
goto error;
|
throw new java::net::SocketException (JvNewStringUTF ("invalid length"));
|
||||||
|
|
||||||
if (::bind (fnum, ptr, len) == 0)
|
if (::bind (fnum, ptr, len) == 0)
|
||||||
{
|
{
|
||||||
socklen_t addrlen = sizeof(u);
|
socklen_t addrlen = sizeof(u);
|
||||||
@ -245,7 +246,8 @@ java::net::PlainDatagramSocketImpl::peek (java::net::InetAddress *i)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
goto error;
|
throw new java::net::SocketException (JvNewStringUTF ("invalid family"));
|
||||||
|
|
||||||
i->address = raddr;
|
i->address = raddr;
|
||||||
return rport;
|
return rport;
|
||||||
error:
|
error:
|
||||||
@ -281,7 +283,8 @@ java::net::PlainDatagramSocketImpl::send (java::net::DatagramPacket *p)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
goto error;
|
throw new java::net::SocketException (JvNewStringUTF ("invalid length"));
|
||||||
|
|
||||||
if (::sendto (fnum, (char *) dbytes, p->getLength(), 0, ptr, len) >= 0)
|
if (::sendto (fnum, (char *) dbytes, p->getLength(), 0, ptr, len) >= 0)
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
@ -337,7 +340,8 @@ java::net::PlainDatagramSocketImpl::receive (java::net::DatagramPacket *p)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
goto error;
|
throw new java::net::SocketException (JvNewStringUTF ("invalid family"));
|
||||||
|
|
||||||
p->setAddress (new InetAddress (raddr, NULL));
|
p->setAddress (new InetAddress (raddr, NULL));
|
||||||
p->setPort (rport);
|
p->setPort (rport);
|
||||||
p->setLength ((jint) retlen);
|
p->setLength ((jint) retlen);
|
||||||
@ -412,7 +416,8 @@ java::net::PlainDatagramSocketImpl::mcastGrp (java::net::InetAddress *inetaddr,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
goto error;
|
throw new java::net::SocketException (JvNewStringUTF ("invalid length"));
|
||||||
|
|
||||||
if (::setsockopt (fnum, level, opname, ptr, len) == 0)
|
if (::setsockopt (fnum, level, opname, ptr, len) == 0)
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
@ -507,7 +512,9 @@ java::net::PlainDatagramSocketImpl::setOption (jint optID,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
goto error;
|
throw
|
||||||
|
new java::net::SocketException (JvNewStringUTF ("invalid length"));
|
||||||
|
|
||||||
if (::setsockopt (fnum, level, opname, ptr, len) != 0)
|
if (::setsockopt (fnum, level, opname, ptr, len) != 0)
|
||||||
goto error;
|
goto error;
|
||||||
return;
|
return;
|
||||||
@ -576,7 +583,7 @@ java::net::PlainDatagramSocketImpl::getOption (jint optID)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
goto error;
|
throw new java::net::SocketException (JvNewStringUTF ("invalid family"));
|
||||||
localAddress = new java::net::InetAddress (laddr, NULL);
|
localAddress = new java::net::InetAddress (laddr, NULL);
|
||||||
}
|
}
|
||||||
return localAddress;
|
return localAddress;
|
||||||
|
@ -153,7 +153,7 @@ java::net::PlainSocketImpl::bind (java::net::InetAddress *host, jint lport)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
goto error;
|
throw new java::net::SocketException (JvNewStringUTF ("invalid length"));
|
||||||
|
|
||||||
// Enable SO_REUSEADDR, so that servers can reuse ports left in TIME_WAIT.
|
// Enable SO_REUSEADDR, so that servers can reuse ports left in TIME_WAIT.
|
||||||
::setsockopt(fnum, SOL_SOCKET, SO_REUSEADDR, (char *) &i, sizeof(i));
|
::setsockopt(fnum, SOL_SOCKET, SO_REUSEADDR, (char *) &i, sizeof(i));
|
||||||
@ -201,17 +201,20 @@ java::net::PlainSocketImpl::connect (java::net::InetAddress *host, jint rport)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
goto error;
|
throw new java::net::SocketException (JvNewStringUTF ("invalid length"));
|
||||||
|
|
||||||
if (::connect (fnum, ptr, len) != 0)
|
if (::connect (fnum, ptr, len) != 0)
|
||||||
goto error;
|
goto error;
|
||||||
address = host;
|
address = host;
|
||||||
port = rport;
|
port = rport;
|
||||||
// A bind may not have been done on this socket; if so, set localport now.
|
// A bind may not have been done on this socket; if so, set localport now.
|
||||||
if (localport == 0)
|
if (localport == 0)
|
||||||
if (::getsockname (fnum, (sockaddr*) &u, &addrlen) == 0)
|
{
|
||||||
localport = ntohs (u.address.sin_port);
|
if (::getsockname (fnum, (sockaddr*) &u, &addrlen) == 0)
|
||||||
else
|
localport = ntohs (u.address.sin_port);
|
||||||
goto error;
|
else
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
char* strerr = strerror (errno);
|
char* strerr = strerror (errno);
|
||||||
@ -272,7 +275,8 @@ java::net::PlainSocketImpl::accept (java::net::PlainSocketImpl *s)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
goto error;
|
throw new java::net::SocketException (JvNewStringUTF ("invalid family"));
|
||||||
|
|
||||||
s->fnum = new_socket;
|
s->fnum = new_socket;
|
||||||
s->localport = localport;
|
s->localport = localport;
|
||||||
s->address = new InetAddress (raddr, NULL);
|
s->address = new InetAddress (raddr, NULL);
|
||||||
@ -445,7 +449,8 @@ java::net::PlainSocketImpl::getOption (jint optID)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
goto error;
|
throw
|
||||||
|
new java::net::SocketException (JvNewStringUTF ("invalid family"));
|
||||||
localAddress = new java::net::InetAddress (laddr, NULL);
|
localAddress = new java::net::InetAddress (laddr, NULL);
|
||||||
}
|
}
|
||||||
return localAddress;
|
return localAddress;
|
||||||
|
Loading…
Reference in New Issue
Block a user