check server from on stream open
This commit is contained in:
parent
01ac2912f5
commit
3882ea669d
|
@ -526,8 +526,7 @@ public class XmppConnection implements Runnable {
|
||||||
tagReader.setInputStream(socket.getInputStream());
|
tagReader.setInputStream(socket.getInputStream());
|
||||||
tagWriter.beginDocument();
|
tagWriter.beginDocument();
|
||||||
final boolean quickStart;
|
final boolean quickStart;
|
||||||
if (socket instanceof SSLSocket) {
|
if (socket instanceof SSLSocket sslSocket) {
|
||||||
final SSLSocket sslSocket = (SSLSocket) socket;
|
|
||||||
SSLSockets.log(account, sslSocket);
|
SSLSockets.log(account, sslSocket);
|
||||||
quickStart = establishStream(SSLSockets.version(sslSocket));
|
quickStart = establishStream(SSLSockets.version(sslSocket));
|
||||||
} else {
|
} else {
|
||||||
|
@ -537,7 +536,16 @@ public class XmppConnection implements Runnable {
|
||||||
if (Thread.currentThread().isInterrupted()) {
|
if (Thread.currentThread().isInterrupted()) {
|
||||||
throw new InterruptedException();
|
throw new InterruptedException();
|
||||||
}
|
}
|
||||||
final boolean success = tag != null && tag.isStart("stream", Namespace.STREAMS);
|
if (tag == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final boolean success = tag.isStart("stream", Namespace.STREAMS);
|
||||||
|
if (success) {
|
||||||
|
final var from = tag.getAttribute("from");
|
||||||
|
if (from == null || !from.equals(account.getServer())) {
|
||||||
|
throw new StateChangingException(Account.State.HOST_UNKNOWN);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (success && quickStart) {
|
if (success && quickStart) {
|
||||||
this.quickStartInProgress = true;
|
this.quickStartInProgress = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue