|
Register | FAQ | The Twelve Commandments | Members List | Calendar | Arcade | Find the Best VPN | Today's Posts | Search |
Adapting Phex (private networks) Private networks, modified versions and similar |
| LinkBack | Thread Tools | Display Modes |
| |||
I found it Hi, gregork: I resolved it. I think it invokes the method too earlier than servent is loaded or made successfully. Consequently, setForcedHostIp method is invoked too early to get a Servent instance. I am not sure when the Servent instance sets up. |
| |||
Hi, gregork: I understood it in total. Servent has a object of Server that must create a LocalHostAddress object or instance that is going to call setForedHostIp, but the setForedHostIp needs a static servent instance. However this instance of Servent isn't set up yet because of the front reason. Recursion enters a dead cycle. |
| |||
Great catch, thank you!! I tried to fix the problem in SVN. Can you verify if it works for you? BTW: there is actually not really a reason to set a forced IP. Phex is pretty good at detecting your public IP once you are connected to the network. There are only very few special cases where it makes sense to set the forced IP. |
| |||
public Server() { hasConnectedIncomming = ConnectionPrefs.HasConnectedIncomming.get().boolea nValue(); lastInConnectionTime = -1; isRunning = false; /** localAddress = new LocalServentAddress( this ); if ( ProxyPrefs.ForcedIp.get().length() > 0) { IpAddress ip = new IpAddress( AddressUtils.parseIP( ProxyPrefs.ForcedIp.get() ) ); localAddress.setForcedHostIP( ip ); } */ } public Server() { hasConnectedIncomming = ConnectionPrefs.HasConnectedIncomming.get().boolea nValue(); lastInConnectionTime = -1; isRunning = false; /** localAddress = new LocalServentAddress( this ); if ( ProxyPrefs.ForcedIp.get().length() > 0) { IpAddress ip = new IpAddress( AddressUtils.parseIP( ProxyPrefs.ForcedIp.get() ) ); localAddress.setForcedHostIP( ip ); } */ } private void setupLocalAddress() { localAddress =new LocalServentAddress(this); if ( ProxyPrefs.ForcedIp.get().length() > 0) { IpAddress ip = new IpAddress( AddressUtils.parseIP( ProxyPrefs.ForcedIp.get() ) ); localAddress.setForcedHostIP( ip ); } } public synchronized void startup() throws IOException { setupLocalAddress(); if (isRunning) { return; } NLogger.debug( Server.class, "Starting listener"); isRunning = true; firewallCheckTimer = new FirewallCheckTimer(); Environment.getInstance().scheduleTimerTask( firewallCheckTimer, FirewallCheckTimer.TIMER_PERIOD, FirewallCheckTimer.TIMER_PERIOD ); bind( NetworkPrefs.ListeningPort.get().intValue() ); // localAddress = new LocalServentAddress( this ); ThreadPool.getInstance().addJob(this, "IncommingListener-" + Integer.toHexString(hashCode())); } private void setupLocalAddress() { localAddress =new LocalServentAddress(this); if ( ProxyPrefs.ForcedIp.get().length() > 0) { IpAddress ip = new IpAddress( AddressUtils.parseIP( ProxyPrefs.ForcedIp.get() ) ); localAddress.setForcedHostIP( ip ); } } public synchronized void startup() throws IOException { setupLocalAddress(); if (isRunning) { return; } NLogger.debug( Server.class, "Starting listener"); isRunning = true; firewallCheckTimer = new FirewallCheckTimer(); public Server() { hasConnectedIncomming = ConnectionPrefs.HasConnectedIncomming.get().boolea nValue(); lastInConnectionTime = -1; isRunning = false; /** localAddress = new LocalServentAddress( this ); if ( ProxyPrefs.ForcedIp.get().length() > 0) { IpAddress ip = new IpAddress( AddressUtils.parseIP( ProxyPrefs.ForcedIp.get() ) ); localAddress.setForcedHostIP( ip ); } */ } private void setupLocalAddress() { localAddress =new LocalServentAddress(this); if ( ProxyPrefs.ForcedIp.get().length() > 0) { IpAddress ip = new IpAddress( AddressUtils.parseIP( ProxyPrefs.ForcedIp.get() ) ); localAddress.setForcedHostIP( ip ); } } public synchronized void startup() throws IOException { setupLocalAddress(); if (isRunning) { return; } NLogger.debug( Server.class, "Starting listener"); isRunning = true; firewallCheckTimer = new FirewallCheckTimer(); Environment.getInstance().scheduleTimerTask( firewallCheckTimer, FirewallCheckTimer.TIMER_PERIOD, FirewallCheckTimer.TIMER_PERIOD ); bind( NetworkPrefs.ListeningPort.get().intValue() ); // localAddress = new LocalServentAddress( this ); ThreadPool.getInstance().addJob(this, "IncommingListener-" + Integer.toHexString(hashCode())); } Environment.getInstance().scheduleTimerTask( firewallCheckTimer, FirewallCheckTimer.TIMER_PERIOD, FirewallCheckTimer.TIMER_PERIOD ); bind( NetworkPrefs.ListeningPort.get().intValue() ); // localAddress = new LocalServentAddress( this ); ThreadPool.getInstance().addJob(this, "IncommingListener-" + Integer.toHexString(hashCode())); } I was just moving the setupLocalAddress method into startup. Actually, your phex is very good and helpful to me. I was a c++ programmer before and new of java programming. So I should say "thank you" to you. |
| |||
Yes moving the method into startup would work too. I liked get ride of the Servent.getInstance() calls. They are just a workaround to keep the code running while I was doing a lot restructuring over the last weeks. Thats why I was handing the objects instances through in my solution. But both things should work... If you like Phex you are also very welcome to help out with coding. So if you like to work on anything or you have some improvements just tell me. |
| |||
Actually I don't know the details how TreeTable works myself. I just added the class from the SwingX project https://swingx.dev.java.net/ if I remember correct and used the functionality. As a roadmap I would just suggest you to think of something easy to improve on the GUI. There are a few things on the Wishlist in the Wiki http://www.phex.org/wiki/index.php/Wishlist or in the Phex Bug Tracker, like this one: SourceForge.net: Detail: 1810708 - clicking enter in result monitor should start passive search I can also assign you one which should be good to start with. As the next step I would suggest to start from the corresponding tab or dialog class to check where to integrate it. Most GUI part is not so difficult like the tables. Most code in Phex uses JGoodies Forms to layout the components. So I would suggest you get familiar with it. But you can also use standard JDK LayoutManagers when you design a whole new panel and you feel more familiar with it. So instead of trying to understand the whole GUI, which is just not possible in short time I would suggest you to start just with the parts where you want to change things. If you feel unsure where to look you can just ask or send me code to review I can help you get back on track. Gregor |
| |