Commits comibned Carl Hasselskog and Jakub Adamek patches for PTCP deadlock fix.
This commit is contained in:
parent
137de02c4f
commit
24a6f9a95d
@ -507,12 +507,15 @@ class PseudoTcpSocketImpl
|
||||
*/
|
||||
public void onTcpReadable(PseudoTCPBase tcp)
|
||||
{
|
||||
//release all thread blocked at read_notify monitor
|
||||
synchronized (read_notify)
|
||||
if(logger.isLoggable(Level.FINER))
|
||||
{
|
||||
logger.log(
|
||||
Level.FINER,
|
||||
"TCP READABLE data available for reading: "+tcp.getAvailable());
|
||||
}
|
||||
//release all thread blocked at read_notify monitor
|
||||
synchronized (read_notify)
|
||||
{
|
||||
read_notify.notifyAll();
|
||||
}
|
||||
}
|
||||
@ -877,7 +880,8 @@ class PseudoTcpSocketImpl
|
||||
* @throws IOException in case of error or if timeout occurs
|
||||
*/
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int length) throws IOException
|
||||
public int read(byte[] buffer, int offset, int length)
|
||||
throws IOException
|
||||
{
|
||||
long start = System.currentTimeMillis();
|
||||
int read;
|
||||
@ -885,13 +889,12 @@ class PseudoTcpSocketImpl
|
||||
{
|
||||
logger.log(Level.FINER, "Read Recv");
|
||||
try
|
||||
{
|
||||
synchronized (read_notify)
|
||||
{
|
||||
read = pseudoTcp.recv(buffer, offset, length);
|
||||
if (logger.isLoggable(Level.FINER))
|
||||
{
|
||||
logger.log(Level.FINER, "Read Recv read count: " + read);
|
||||
logger.log(Level.FINER,
|
||||
"Read Recv read count: " + read);
|
||||
}
|
||||
if (read > 0)
|
||||
{
|
||||
@ -910,19 +913,30 @@ class PseudoTcpSocketImpl
|
||||
pseudoTcp.closedown(exc);
|
||||
throw exc;
|
||||
}
|
||||
synchronized (read_notify)
|
||||
{
|
||||
if(pseudoTcp.getAvailable() == 0)
|
||||
{
|
||||
read_notify.wait(left);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
synchronized (read_notify)
|
||||
{
|
||||
if(pseudoTcp.getAvailable() == 0)
|
||||
{
|
||||
read_notify.wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (logger.isLoggable(Level.FINER))
|
||||
{
|
||||
logger.log(
|
||||
Level.FINER,
|
||||
"Read notified: " + pseudoTcp.getAvailable());
|
||||
}
|
||||
}
|
||||
if (exception != null)
|
||||
{
|
||||
throw exception;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user