@@ -76,7 +76,7 @@ private void applicationEnding() {
76
76
77
77
private void buildAndConnectObsController () {
78
78
var save = this .save .get ();
79
- if (!save .isObsEnabled () || connected || shuttingDown ) {
79
+ if (!save .isObsEnabled () || ( connected && ! settingsStillSame ( false )) || shuttingDown ) {
80
80
log .trace ("Obs is disabled({})/already connected({})/we are shutting down({})" , save .isObsEnabled (), connected , shuttingDown );
81
81
disconnectController ();
82
82
return ;
@@ -94,7 +94,10 @@ private void buildAndConnectObsController() {
94
94
private void doBuildAndConnectObsController () {
95
95
var save = this .save .get ();
96
96
log .debug ("Connecting to OBS" );
97
- if (settingsStillSame () && controller != null ) {
97
+ if (settingsStillSame (true ) && controller != null ) {
98
+ if (connected ) {
99
+ return ;
100
+ }
98
101
connected = true ;
99
102
controller .connect ();
100
103
return ;
@@ -197,15 +200,17 @@ private void onError(ReasonThrowable reasonThrowable) {
197
200
connected = false ;
198
201
}
199
202
200
- private boolean settingsStillSame () {
203
+ private boolean settingsStillSame (boolean updatePrevious ) {
201
204
var port = NumberUtils .toInt (save .get ().getObsPort (), -1 );
202
205
var address = save .get ().getObsAddress ();
203
206
var password = StringUtils .trimToNull (save .get ().getObsPassword ());
204
207
var settings = List .<Object >of (port , Objects .requireNonNullElse (address , "-" ), Objects .requireNonNullElse (password , "-" ));
205
208
if (settings .equals (previousSettings )) {
206
209
return true ;
207
210
}
208
- previousSettings = settings ;
211
+ if (updatePrevious ) {
212
+ previousSettings = settings ;
213
+ }
209
214
return false ;
210
215
}
211
216
0 commit comments