Skip to content
Browse files

Merge branch 'master' of https://github.com/CSEMike/OneSwarm into fil…

…eBrowser3
  • Loading branch information...
2 parents 007cfa4 + a9f8431 commit cbdf4ebe529a028b06ad620c1dd8bdd5056523ed @DaemonF DaemonF committed May 10, 2012
View
61 az_src/jsocks/net/sourceforge/jsocks/SocksEcho.java
@@ -1,11 +1,35 @@
package net.sourceforge.jsocks;
-import java.awt.*;
-import java.awt.event.*;
-import java.net.*;
-import java.io.*;
-import net.sourceforge.jsocks.socks.*;
+import java.awt.Button;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.Label;
+import java.awt.SystemColor;
+import java.awt.TextArea;
+import java.awt.TextField;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowListener;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.DatagramPacket;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.URL;
+import java.net.UnknownHostException;
+
import net.sourceforge.jsocks.socks.Proxy;
+import net.sourceforge.jsocks.socks.Socks5DatagramSocket;
+import net.sourceforge.jsocks.socks.Socks5Proxy;
+import net.sourceforge.jsocks.socks.SocksDialog;
+import net.sourceforge.jsocks.socks.SocksServerSocket;
+import net.sourceforge.jsocks.socks.SocksSocket;
public class SocksEcho extends Frame
implements ActionListener,
@@ -82,7 +106,8 @@ else if(component[i] instanceof TextField)
//ActionListener interface
///////////////////////////
- public void actionPerformed(ActionEvent ae){
+ @Override
+public void actionPerformed(ActionEvent ae){
Object source = ae.getSource();
if(source == proxy_button)
@@ -105,6 +130,7 @@ else if(source == clear_button)
//Runnable interface
///////////////////////////////
+@Override
public void run(){
boolean finished_OK = true;
try{
@@ -153,7 +179,7 @@ public void run(){
private void onConnect(){
if(mode == CONNECT_MODE){
- status("Diconnecting...");
+ status("Disconnecting...");
abort_connection();
return;
}else if(mode != COMMAND_MODE)
@@ -578,22 +604,29 @@ void guiInit(){
// WindowListener Interface
/////////////////////////////////
- public void windowActivated(java.awt.event.WindowEvent e){
+ @Override
+public void windowActivated(java.awt.event.WindowEvent e){
}
- public void windowDeactivated(java.awt.event.WindowEvent e){
+ @Override
+public void windowDeactivated(java.awt.event.WindowEvent e){
}
- public void windowOpened(java.awt.event.WindowEvent e){
+ @Override
+public void windowOpened(java.awt.event.WindowEvent e){
}
- public void windowClosing(java.awt.event.WindowEvent e){
+ @Override
+public void windowClosing(java.awt.event.WindowEvent e){
if(e.getWindow() == this) onQuit();
else
e.getWindow().dispose();
}
- public void windowClosed(java.awt.event.WindowEvent e){
+ @Override
+public void windowClosed(java.awt.event.WindowEvent e){
}
- public void windowIconified(java.awt.event.WindowEvent e){
+ @Override
+public void windowIconified(java.awt.event.WindowEvent e){
}
- public void windowDeiconified(java.awt.event.WindowEvent e){
+ @Override
+public void windowDeiconified(java.awt.event.WindowEvent e){
}
View
179 ...rc/src/com/aelitis/azureus/core/networkmanager/impl/tcp/IncomingSocketChannelManager.java
@@ -22,23 +22,40 @@
package com.aelitis.azureus.core.networkmanager.impl.tcp;
-import java.net.*;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
import java.nio.ByteBuffer;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
-import java.util.*;
-
-import org.gudy.azureus2.core3.config.*;
-import org.gudy.azureus2.core3.logging.*;
-import org.gudy.azureus2.core3.util.*;
-
-import com.aelitis.azureus.core.networkmanager.*;
+import java.util.Arrays;
+import java.util.Date;
+
+import org.gudy.azureus2.core3.config.COConfigurationManager;
+import org.gudy.azureus2.core3.config.ParameterListener;
+import org.gudy.azureus2.core3.logging.LogAlert;
+import org.gudy.azureus2.core3.logging.LogEvent;
+import org.gudy.azureus2.core3.logging.LogIDs;
+import org.gudy.azureus2.core3.logging.Logger;
+import org.gudy.azureus2.core3.util.AEMonitor;
+import org.gudy.azureus2.core3.util.Debug;
+import org.gudy.azureus2.core3.util.RandomUtils;
+import org.gudy.azureus2.core3.util.SimpleTimer;
+import org.gudy.azureus2.core3.util.SystemTime;
+import org.gudy.azureus2.core3.util.TimerEvent;
+import org.gudy.azureus2.core3.util.TimerEventPerformer;
+import org.gudy.azureus2.core3.util.TimerEventPeriodic;
+
+import com.aelitis.azureus.core.networkmanager.ConnectionEndpoint;
+import com.aelitis.azureus.core.networkmanager.Transport;
+import com.aelitis.azureus.core.networkmanager.VirtualServerChannelSelector;
+import com.aelitis.azureus.core.networkmanager.VirtualServerChannelSelectorFactory;
import com.aelitis.azureus.core.networkmanager.admin.NetworkAdmin;
import com.aelitis.azureus.core.networkmanager.admin.NetworkAdminPropertyChangeListener;
import com.aelitis.azureus.core.networkmanager.impl.IncomingConnectionManager;
import com.aelitis.azureus.core.networkmanager.impl.ProtocolDecoder;
-import com.aelitis.azureus.core.networkmanager.impl.TransportHelperFilter;
import com.aelitis.azureus.core.networkmanager.impl.TransportCryptoManager;
+import com.aelitis.azureus.core.networkmanager.impl.TransportHelperFilter;
/**
@@ -52,6 +69,12 @@
private final String port_config_key;
private final String port_enable_config_key;
+ private final ParameterListener port_config_listener;
+ private final ParameterListener port_enable_config_listener;
+ private final ParameterListener rcvbuf_listener;
+ private final NetworkAdminPropertyChangeListener bind_address_listener;
+ private final TimerEventPeriodic periodic_listener;
+
private int tcp_listen_port;
private int so_rcvbuf_size = COConfigurationManager.getIntParameter( "network.tcp.socket.SO_RCVBUF" );
@@ -63,7 +86,7 @@
private VirtualServerChannelSelector[] serverSelectors = new VirtualServerChannelSelector[0];
private int listenFailCounts[] = new int[0];
- private IncomingConnectionManager incoming_manager = IncomingConnectionManager.getSingleton();
+ private final IncomingConnectionManager incoming_manager = IncomingConnectionManager.getSingleton();
protected AEMonitor this_mon = new AEMonitor( "IncomingSocketChannelManager" );
@@ -80,56 +103,62 @@ public IncomingSocketChannelManager( String _port_config_key, String _port_enabl
tcp_listen_port = COConfigurationManager.getIntParameter( port_config_key );
- //allow dynamic port number changes
- COConfigurationManager.addParameterListener( port_config_key, new ParameterListener() {
- public void parameterChanged(String parameterName) {
- int port = COConfigurationManager.getIntParameter( port_config_key );
- if( port != tcp_listen_port ) {
- tcp_listen_port = port;
- restart();
- }
- }
- });
+ // allow dynamic port number changes
+ port_config_listener = new ParameterListener() {
+ @Override
+ public void parameterChanged(String parameterName) {
+ int port = COConfigurationManager.getIntParameter(port_config_key);
+ if (port != tcp_listen_port) {
+ tcp_listen_port = port;
+ restart();
+ }
+ }
+ };
+ COConfigurationManager.addParameterListener(port_config_key, port_config_listener);
- COConfigurationManager.addParameterListener( port_enable_config_key, new ParameterListener() {
- public void parameterChanged(String parameterName) {
- restart();
- }
- });
+ port_enable_config_listener = new ParameterListener() {
+ @Override
+ public void parameterChanged(String parameterName) {
+ restart();
+ }
+ };
+ COConfigurationManager.addParameterListener(port_enable_config_key,
+ port_enable_config_listener);
- //allow dynamic receive buffer size changes
- COConfigurationManager.addParameterListener( "network.tcp.socket.SO_RCVBUF", new ParameterListener() {
- public void parameterChanged(String parameterName) {
- int size = COConfigurationManager.getIntParameter( "network.tcp.socket.SO_RCVBUF" );
- if( size != so_rcvbuf_size ) {
- so_rcvbuf_size = size;
- restart();
- }
- }
- });
+ // allow dynamic receive buffer size changes
+ rcvbuf_listener = new ParameterListener() {
+ @Override
+ public void parameterChanged(String parameterName) {
+ int size = COConfigurationManager.getIntParameter("network.tcp.socket.SO_RCVBUF");
+ if (size != so_rcvbuf_size) {
+ so_rcvbuf_size = size;
+ restart();
+ }
+ }
+ };
+ COConfigurationManager
+ .addParameterListener("network.tcp.socket.SO_RCVBUF", rcvbuf_listener);
//allow dynamic bind address changes
-
- NetworkAdmin.getSingleton().addPropertyChangeListener(
- new NetworkAdminPropertyChangeListener()
- {
- public void
- propertyChanged(
- String property )
- {
- if ( property == NetworkAdmin.PR_DEFAULT_BIND_ADDRESS ){
-
- InetAddress[] addresses = NetworkAdmin.getSingleton().getMultiHomedServiceBindAddresses();
-
- if ( !Arrays.equals(addresses, default_bind_addresses)) {
-
- default_bind_addresses = addresses;
-
- restart();
- }
- }
- }
- });
+ bind_address_listener = new NetworkAdminPropertyChangeListener() {
+ @Override
+ public void
+ propertyChanged(String property) {
+ if (property == NetworkAdmin.PR_DEFAULT_BIND_ADDRESS) {
+
+ InetAddress[] addresses = NetworkAdmin.getSingleton()
+ .getMultiHomedServiceBindAddresses();
+
+ if (!Arrays.equals(addresses, default_bind_addresses)) {
+
+ default_bind_addresses = addresses;
+
+ restart();
+ }
+ }
+ }
+ };
+ NetworkAdmin.getSingleton().addPropertyChangeListener(bind_address_listener);
//start processing
@@ -140,9 +169,11 @@ public void parameterChanged(String parameterName) {
//it seems that sometimes under OSX that listen server sockets sometimes stop accepting incoming connections for some unknown reason
//this checker tests to make sure the listen socket is still accepting connections, and if not, recreates the socket
- SimpleTimer.addPeriodicEvent("IncomingSocketChannelManager:concheck", 60 * 1000, new TimerEventPerformer()
+ periodic_listener = SimpleTimer.addPeriodicEvent("IncomingSocketChannelManager:concheck",
+ 60 * 1000, new TimerEventPerformer()
{
- public void
+ @Override
+ public void
perform(
TimerEvent ev )
{
@@ -198,6 +229,20 @@ public void parameterChanged(String parameterName) {
});
}
+ /**
+ * Stop listeners associated with this Channel Manager, so that it is safe
+ * to dispose of.
+ */
+ public void close() {
+ COConfigurationManager.removeParameterListener(port_config_key, port_config_listener);
+ COConfigurationManager.removeParameterListener(port_enable_config_key,
+ port_enable_config_listener);
+ COConfigurationManager.removeParameterListener("network.tcp.socket.SO_RCVBUF",
+ rcvbuf_listener);
+ NetworkAdmin.getSingleton().removePropertyChangeListener(bind_address_listener);
+ periodic_listener.cancel();
+ }
+
public boolean
isEnabled()
{
@@ -258,7 +303,8 @@ public void parameterChanged(String parameterName) {
TcpSelectListener implements
VirtualServerChannelSelector.SelectListener
{
- public void newConnectionAccepted( final ServerSocketChannel server, final SocketChannel channel ) {
+ @Override
+ public void newConnectionAccepted( final ServerSocketChannel server, final SocketChannel channel ) {
InetAddress remote_ia = channel.socket().getInetAddress();
@@ -271,11 +317,13 @@ public void newConnectionAccepted( final ServerSocketChannel server, final Socke
final TCPTransportHelper helper = new TCPTransportHelper( channel );
TransportCryptoManager.getSingleton().manageCrypto( helper, null, true, null, new TransportCryptoManager.HandshakeListener() {
- public void handshakeSuccess( ProtocolDecoder decoder, ByteBuffer remaining_initial_data ) {
+ @Override
+ public void handshakeSuccess( ProtocolDecoder decoder, ByteBuffer remaining_initial_data ) {
process( server.socket().getLocalPort(), decoder.getFilter());
}
- public void
+ @Override
+ public void
handshakeFailure(
Throwable failure_msg )
{
@@ -306,19 +354,22 @@ public void handshakeSuccess( ProtocolDecoder decoder, ByteBuffer remaining_init
helper.close( "Handshake failure: " + Debug.getNestedExceptionMessage( failure_msg ));
}
- public void
+ @Override
+ public void
gotSecret(
byte[] session_secret )
{
}
- public int
+ @Override
+ public int
getMaximumPlainHeaderLength()
{
return( incoming_manager.getMaxMinMatchBufferSize());
}
- public int
+ @Override
+ public int
matchPlainHeader(
ByteBuffer buffer )
{
View
36 ...om/aelitis/azureus/core/networkmanager/impl/tcp/VirtualBlockingServerChannelSelector.java
@@ -22,11 +22,20 @@
package com.aelitis.azureus.core.networkmanager.impl.tcp;
-import java.net.*;
-import java.nio.channels.*;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.nio.channels.AsynchronousCloseException;
+import java.nio.channels.ServerSocketChannel;
+import java.nio.channels.SocketChannel;
-import org.gudy.azureus2.core3.logging.*;
-import org.gudy.azureus2.core3.util.*;
+import org.gudy.azureus2.core3.logging.LogAlert;
+import org.gudy.azureus2.core3.logging.LogEvent;
+import org.gudy.azureus2.core3.logging.LogIDs;
+import org.gudy.azureus2.core3.logging.Logger;
+import org.gudy.azureus2.core3.util.AEMonitor;
+import org.gudy.azureus2.core3.util.AEThread;
+import org.gudy.azureus2.core3.util.Debug;
+import org.gudy.azureus2.core3.util.SystemTime;
import com.aelitis.azureus.core.networkmanager.VirtualServerChannelSelector;
@@ -65,7 +74,8 @@ public VirtualBlockingServerChannelSelector( InetSocketAddress _bind_address, in
* Start the server and begin accepting incoming connections.
*
*/
- public void start() {
+ @Override
+public void start() {
try{
this_mon.enter();
@@ -81,7 +91,8 @@ public void start() {
if (Logger.isEnabled()) Logger.log(new LogEvent(LOGID, "TCP incoming server socket " + bind_address));
AEThread accept_thread = new AEThread( "VServerSelector:port" + bind_address.getPort() ) {
- public void runSupport() {
+ @Override
+ public void runSupport() {
accept_loop();
}
};
@@ -105,12 +116,14 @@ public void runSupport() {
/**
* Stop the server.
*/
- public void stop() {
+ @Override
+public void stop() {
try{
this_mon.enter();
if( server_channel != null ) {
try {
+ server_channel.socket().close();
server_channel.close();
server_channel = null;
}
@@ -147,21 +160,24 @@ protected void accept_loop() {
* Is this selector actively running
* @return true if enabled, false if not running
*/
- public boolean isRunning() {
+ @Override
+public boolean isRunning() {
if( server_channel != null && server_channel.isOpen() ) return true;
return false;
}
- public InetAddress getBoundToAddress() {
+ @Override
+public InetAddress getBoundToAddress() {
if( server_channel != null ) {
return server_channel.socket().getInetAddress();
}
return null;
}
- public long getTimeOfLastAccept() {
+ @Override
+public long getTimeOfLastAccept() {
return last_accept_time;
}
}
View
3 javatests/edu/washington/cs/oneswarm/test/integration/ServiceSharingChannelReuseTest.java
@@ -15,6 +15,7 @@
import org.junit.BeforeClass;
import org.junit.Test;
+import edu.washington.cs.oneswarm.f2f.datagram.DatagramConnection;
import edu.washington.cs.oneswarm.f2f.servicesharing.EchoServer;
import edu.washington.cs.oneswarm.f2f.servicesharing.ServiceSharingManager;
import edu.washington.cs.oneswarm.test.util.TestUtils;
@@ -39,7 +40,7 @@ public void setupLogging() {
logFinest(logger);
logFinest(ServiceSharingSingleProcessTest.logger);
logFinest(EchoServer.logger);
- // logFinest(DatagramConnection.logger);
+ logFinest(DatagramConnection.logger);
// logFinest(DatagramRateLimitedChannelQueue.logger);
// logFinest(ReadController.logger);
View
2 oneswarm_f2f/src/edu/washington/cs/oneswarm/f2f/OSF2FMain.java
@@ -412,7 +412,7 @@ public void connectionRouted(NetworkConnection connection, Object routing_data)
.getNotionalAddress().getAddress().getHostAddress(), remotePub);
connection.close();
} else if (f.isBlocked()) {
- logger.warning("connection from blocked user: " + f.getNick() + ", diconnecting");
+ logger.warning("connection from blocked user: " + f.getNick() + ", disconnecting");
connection.close();
} else {
logger.finer("connection from: " + f.getNick());
View
15 oneswarm_f2f/src/edu/washington/cs/oneswarm/f2f/servicesharing/ClientService.java
@@ -24,18 +24,12 @@
private PortMatcher matcher;
final long serverSearchKey;
final int serviceChannels;
+ private IncomingSocketChannelManager iscm;
public ClientService(long key) {
this.serverSearchKey = key;
COConfigurationManager.setParameter(getEnabledKey(), false);
this.serviceChannels = COConfigurationManager.getIntParameter(getChannelsKey());
- IncomingSocketChannelManager incomingSocketChannelManager = new IncomingSocketChannelManager(
- getPortKey(), getEnabledKey());
- try {
- incomingSocketChannelManager.setExplicitBindAddress(InetAddress.getByName("127.0.0.1"));
- } catch (UnknownHostException e) {
- }
-
}
public void activate() {
@@ -46,6 +40,12 @@ public void activate() {
return;
}
active = true;
+ iscm = new IncomingSocketChannelManager(getPortKey(), getEnabledKey());
+ try {
+ iscm.setExplicitBindAddress(InetAddress.getByName("127.0.0.1"));
+ } catch (UnknownHostException e) {
+ }
+
try {
int port = getPort();
COConfigurationManager.setParameter(getEnabledKey(), true);
@@ -114,6 +114,7 @@ public void deactivate() {
COConfigurationManager.removeParameter(getNameKey());
COConfigurationManager.removeParameter(getPortKey());
COConfigurationManager.removeParameter(getEnabledKey());
+ iscm.close();
}
private String getEnabledKey() {
View
1 oneswarm_gwt_ui/src/edu/washington/cs/oneswarm/ui/gwt/OneSwarmGWT.gwt.xml
@@ -43,7 +43,6 @@
<!-- <source path="embedded"/> -->
<source path="rpc" />
<source path="client" />
-
<!-- speed up compilation during development -->
<set-property name="user.agent" value="safari,gecko1_8" />
View
8 oneswarm_gwt_ui/src/edu/washington/cs/oneswarm/ui/gwt/client/fileDialog/FileBrowser.java
@@ -7,8 +7,6 @@
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.logical.shared.OpenEvent;
import com.google.gwt.event.logical.shared.OpenHandler;
-import com.google.gwt.event.logical.shared.SelectionEvent;
-import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HasTreeItems;
@@ -137,6 +135,12 @@ private void growTree(final HasTreeItems root, String filePath) {
return;
}
+ if(root instanceof FileTreeItem)
+ if(((FileTreeItem) root).fileStatus() == FileInfo.FileStatusFlag.NO_READ_PERMISSION){
+ root.addItem(new FileTreeItem(msg.file_browser_label_unreadable_directory()));
+ ((FileTreeItem) root).setState(true);
+ }
+
fileSystem.listFiles(session, filePath, new AsyncCallback<FileInfo[]>() {
public void onFailure(Throwable caught) {
callback.onFailure(caught);

0 comments on commit cbdf4eb

Please sign in to comment.
Something went wrong with that request. Please try again.