comparison src/viewer_swing/java/com/glavsoft/viewer/Viewer.java @ 36:b7d4d0349f99

write part of reconnection and remove warning.
author one
date Tue, 18 Sep 2012 17:23:19 +0900
parents 1b81deb0abb3
children c2f0b6907448
comparison
equal deleted inserted replaced
35:1b81deb0abb3 36:b7d4d0349f99
287 forceReconnection = false; 287 forceReconnection = false;
288 } 288 }
289 289
290 tryAgain = true; 290 tryAgain = true;
291 while (tryAgain) { 291 while (tryAgain) {
292 workingSocket = connectionManager.connectToHost(connectionParams, settings, rfb); 292 if(workingSocket==null)
293 workingSocket = connectionManager.connectToHost(connectionParams, settings, rfb);
293 if (null == workingSocket) { 294 if (null == workingSocket) {
294 closeApp(); 295 closeApp();
295 break; 296 break;
296 } 297 }
297 logger.info("Connected"); 298 logger.info("Connected");
316 uiSettings.addListener(surface); 317 uiSettings.addListener(surface);
317 containerFrame = createContainer(); 318 containerFrame = createContainer();
318 connectionManager.setContainerFrame(containerFrame); 319 connectionManager.setContainerFrame(containerFrame);
319 updateFrameTitle(); 320 updateFrameTitle();
320 if(rfb != null) { 321 if(rfb != null) {
322 rfb.setViewer(this);
321 runAcceptThread(); 323 runAcceptThread();
322 rfb.setProtocolContext(workingProtocol); 324 rfb.setProtocolContext(workingProtocol);
323 rfb.notProxy(); 325 rfb.notProxy();
324 workingProtocol.startTreeClientHandling(this,surface, clipboardController,rfb); 326 workingProtocol.startTreeClientHandling(this,surface, clipboardController,rfb);
325 } else { 327 } else {
632 System.exit(0); 634 System.exit(0);
633 } 635 }
634 Viewer viewer = new Viewer(parser); 636 Viewer viewer = new Viewer(parser);
635 SwingUtilities.invokeLater(viewer); 637 SwingUtilities.invokeLater(viewer);
636 } 638 }
639
640 public void setSocket(Socket soc) {
641 workingSocket = soc;
642 }
643
644 public void close() {
645 try {
646 workingProtocol.getWriter().close();
647 workingProtocol.getReader().close();
648 cleanUpUISessionAndConnection();
649 } catch (IOException e) {
650 e.printStackTrace();
651 } catch (TransportException e) {
652 e.printStackTrace();
653 }
654 }
655
637 } 656 }