mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-02 14:55:58 +01:00
Notify PacketReader in case of TLS exceptions
PacketReader will be waiting in startup() as long as either: - the timeout occurs - notify is called because the last feature stanza was parser - notify is called because of an exception while parsing
This commit is contained in:
parent
5a19668544
commit
b6fb1f3743
1 changed files with 8 additions and 6 deletions
|
@ -97,13 +97,12 @@ class PacketReader {
|
||||||
*/
|
*/
|
||||||
synchronized public void startup() throws NoResponseException, IOException {
|
synchronized public void startup() throws NoResponseException, IOException {
|
||||||
readerThread.start();
|
readerThread.start();
|
||||||
// Wait for stream tag before returning. We'll wait a couple of seconds before
|
|
||||||
// giving up and throwing an error.
|
|
||||||
try {
|
try {
|
||||||
// A waiting thread may be woken up before the wait time or a notify
|
// Wait until either:
|
||||||
// (although this is a rare thing). Therefore, we continue waiting
|
// - the servers last features stanza has been parsed
|
||||||
// until either the server's features have been parsed (and hence a notify was
|
// - an exception is thrown while parsing
|
||||||
// made) or the total wait time has elapsed.
|
// - the timeout occurs
|
||||||
wait(connection.getPacketReplyTimeout());
|
wait(connection.getPacketReplyTimeout());
|
||||||
}
|
}
|
||||||
catch (InterruptedException ie) {
|
catch (InterruptedException ie) {
|
||||||
|
@ -288,6 +287,9 @@ class PacketReader {
|
||||||
// The exception can be ignored if the the connection is 'done'
|
// The exception can be ignored if the the connection is 'done'
|
||||||
// or if the it was caused because the socket got closed
|
// or if the it was caused because the socket got closed
|
||||||
if (!(done || connection.isSocketClosed())) {
|
if (!(done || connection.isSocketClosed())) {
|
||||||
|
synchronized(this) {
|
||||||
|
this.notify();
|
||||||
|
}
|
||||||
// Close the connection and notify connection listeners of the
|
// Close the connection and notify connection listeners of the
|
||||||
// error.
|
// error.
|
||||||
connection.notifyConnectionError(e);
|
connection.notifyConnectionError(e);
|
||||||
|
|
Loading…
Reference in a new issue