File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
src/AndroidClient/client/src/main/java/net/servicestack/client/sse Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -554,17 +554,26 @@ public EventStream(ServerEventsClient client) {
554554 @ Override
555555 public void run () {
556556 try {
557+ if (running .get ())
558+ return ;
559+ running .set (true );
560+
557561 URL streamUri = new URL (client .getEventStreamUri ());
558562 HttpURLConnection req = (HttpURLConnection ) streamUri .openConnection ();
559563
560564 InputStream is = new BufferedInputStream (req .getInputStream ());
561565 errorsCount .set (0 );
562566 readStream (is );
563- } catch (IOException e ) {
567+
568+ running .set (false );
569+ } catch (Exception e ) {
564570 Log .e ("Error reading from event-stream, continuous errors: " + errorsCount .incrementAndGet (), e );
565571 Log .e (Utils .getStackTrace (e ));
572+ running .set (false );
566573 } finally {
567- client .restart ();
574+ if (!running .get ()){
575+ client .restart ();
576+ }
568577 }
569578 }
570579
You can’t perform that action at this time.
0 commit comments