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)
|
public void onTcpReadable(PseudoTCPBase tcp)
|
||||||
{
|
{
|
||||||
//release all thread blocked at read_notify monitor
|
if(logger.isLoggable(Level.FINER))
|
||||||
synchronized (read_notify)
|
|
||||||
{
|
{
|
||||||
logger.log(
|
logger.log(
|
||||||
Level.FINER,
|
Level.FINER,
|
||||||
"TCP READABLE data available for reading: "+tcp.getAvailable());
|
"TCP READABLE data available for reading: "+tcp.getAvailable());
|
||||||
|
}
|
||||||
|
//release all thread blocked at read_notify monitor
|
||||||
|
synchronized (read_notify)
|
||||||
|
{
|
||||||
read_notify.notifyAll();
|
read_notify.notifyAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -877,7 +880,8 @@ class PseudoTcpSocketImpl
|
|||||||
* @throws IOException in case of error or if timeout occurs
|
* @throws IOException in case of error or if timeout occurs
|
||||||
*/
|
*/
|
||||||
@Override
|
@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();
|
long start = System.currentTimeMillis();
|
||||||
int read;
|
int read;
|
||||||
@ -885,13 +889,12 @@ class PseudoTcpSocketImpl
|
|||||||
{
|
{
|
||||||
logger.log(Level.FINER, "Read Recv");
|
logger.log(Level.FINER, "Read Recv");
|
||||||
try
|
try
|
||||||
{
|
|
||||||
synchronized (read_notify)
|
|
||||||
{
|
{
|
||||||
read = pseudoTcp.recv(buffer, offset, length);
|
read = pseudoTcp.recv(buffer, offset, length);
|
||||||
if (logger.isLoggable(Level.FINER))
|
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)
|
if (read > 0)
|
||||||
{
|
{
|
||||||
@ -910,19 +913,30 @@ class PseudoTcpSocketImpl
|
|||||||
pseudoTcp.closedown(exc);
|
pseudoTcp.closedown(exc);
|
||||||
throw exc;
|
throw exc;
|
||||||
}
|
}
|
||||||
|
synchronized (read_notify)
|
||||||
|
{
|
||||||
|
if(pseudoTcp.getAvailable() == 0)
|
||||||
|
{
|
||||||
read_notify.wait(left);
|
read_notify.wait(left);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
synchronized (read_notify)
|
||||||
|
{
|
||||||
|
if(pseudoTcp.getAvailable() == 0)
|
||||||
{
|
{
|
||||||
read_notify.wait();
|
read_notify.wait();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (logger.isLoggable(Level.FINER))
|
if (logger.isLoggable(Level.FINER))
|
||||||
{
|
{
|
||||||
logger.log(
|
logger.log(
|
||||||
Level.FINER,
|
Level.FINER,
|
||||||
"Read notified: " + pseudoTcp.getAvailable());
|
"Read notified: " + pseudoTcp.getAvailable());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (exception != null)
|
if (exception != null)
|
||||||
{
|
{
|
||||||
throw exception;
|
throw exception;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user