Fixes a failure to close a Socket.
This commit is contained in:
parent
8cfe630e79
commit
c73c5ef83d
@ -126,32 +126,54 @@ public class GoogleTurnSSLCandidateHarvester
|
|||||||
protected HostCandidate getHostCandidate(HostCandidate hostCand)
|
protected HostCandidate getHostCandidate(HostCandidate hostCand)
|
||||||
{
|
{
|
||||||
HostCandidate cand = null;
|
HostCandidate cand = null;
|
||||||
|
Socket sock = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Socket sock = new Socket(stunServer.getAddress(),
|
sock = new Socket(stunServer.getAddress(), stunServer.getPort());
|
||||||
stunServer.getPort());
|
|
||||||
|
|
||||||
OutputStream outputStream = sock.getOutputStream();
|
OutputStream outputStream = sock.getOutputStream();
|
||||||
InputStream inputStream = sock.getInputStream();
|
InputStream inputStream = sock.getInputStream();
|
||||||
|
|
||||||
if(sslHandshake(inputStream, outputStream))
|
if(sslHandshake(inputStream, outputStream))
|
||||||
{
|
{
|
||||||
cand = new HostCandidate(new IceTcpSocketWrapper(
|
Component parentComponent = hostCand.getParentComponent();
|
||||||
new MultiplexingSocket(sock)),
|
|
||||||
hostCand.getParentComponent(), Transport.TCP);
|
|
||||||
hostCand.getParentComponent().getParentStream().
|
|
||||||
getParentAgent().getStunStack().addSocket(
|
|
||||||
cand.getStunSocket(null));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
catch(Exception io)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
cand
|
||||||
|
= new HostCandidate(
|
||||||
|
new IceTcpSocketWrapper(
|
||||||
|
new MultiplexingSocket(sock)),
|
||||||
|
parentComponent,
|
||||||
|
Transport.TCP);
|
||||||
|
parentComponent
|
||||||
|
.getParentStream()
|
||||||
|
.getParentAgent()
|
||||||
|
.getStunStack()
|
||||||
|
.addSocket(cand.getStunSocket(null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
cand = null;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if ((cand == null) && (sock != null))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
sock.close();
|
||||||
|
}
|
||||||
|
catch (IOException ioe)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* We failed to close sock but that should not be much of a
|
||||||
|
* problem because we were not closing it in earlier
|
||||||
|
* revisions.
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return cand;
|
return cand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user