pocoproject/poco — pull request #383 by cristiantm (2014-02-21 11:50:17+00:00)
Title: Fix to #380. DialogSocket+SecureServerSocket was crashing (SIGSEGV) when a timeout occours 

DialogSocket was crashing (SIGSEGV) when a timeout occours when it is used combined to SecureServerSocket (#380)

That happens because receibeBytes() will return an error code (n < 0) when there is a timeout (or other errors). Then when DialogSocket wants to refill its buffer, it will "refill" with a negative number of bytes and crash.

This fix checks the value of n. If it is >0, there is new data and the refill proceeds. If it is an error, it wont proceed.