|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SimpleGnutellaServer
public class SimpleGnutellaServer
This is a simple Gnutella server implemented using the Sandstorm Gnutella library. It correctly implements packet routing. It does not respond to queries or host any shared files itself; it simply routes packets to other hosts on the network.
Nested Class Summary | |
---|---|
(package private) class |
SimpleGnutellaServer.timerEvent
Small internal class to represent a timer event. |
Field Summary | |
---|---|
private static boolean |
ACCEPT_CONNECTIONS
|
private static int |
CATCHER_CONNECTIONS
|
private static int |
CLEAN_TIMER_FREQUENCY
|
private static boolean |
DEBUG
|
private static boolean |
DO_CATCHER
|
private static boolean |
DO_CLEANER
|
private GnutellaServer |
gs
|
private ManagerIF |
mgr
|
private static int |
MIN_CONNECTIONS
|
private java.lang.String |
myName
|
private SinkIF |
mySink
|
private int |
num_connections
|
private static int |
NUM_FILES
|
private static int |
NUM_KB
|
private java.util.Hashtable |
packetTable
|
private static boolean |
ROUTE_PACKETS
|
private static boolean |
SEND_PONGS
|
private static java.lang.String |
SERVER_HOSTNAME
|
private ssTimer |
timer
|
private static boolean |
VERBOSE
|
Constructor Summary | |
---|---|
SimpleGnutellaServer()
|
Method Summary | |
---|---|
void |
destroy()
Called when an event handler is destroyed. |
private void |
doCatcher()
|
private void |
doClean(SimpleGnutellaServer.timerEvent ev)
|
private void |
doTimer(SimpleGnutellaServer.timerEvent ev)
|
private void |
forwardPacket(GnutellaPacket pkt)
|
private void |
forwardPacketToAll(GnutellaPacket pkt)
|
void |
handleEvent(QueueElementIF item)
The main event handling code. |
void |
handleEvents(QueueElementIF[] items)
Handle the events corresponding to the given QueueElementIF array. |
void |
init(ConfigDataIF config)
Called when an event handler is initialized. |
private boolean |
rememberPacket(GnutellaPacket pkt)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final boolean DEBUG
private static final boolean VERBOSE
private static boolean DO_CLEANER
private static boolean ACCEPT_CONNECTIONS
private static boolean SEND_PONGS
private static boolean ROUTE_PACKETS
private static final int CLEAN_TIMER_FREQUENCY
private static java.lang.String SERVER_HOSTNAME
private static boolean DO_CATCHER
private static int CATCHER_CONNECTIONS
private static final int MIN_CONNECTIONS
private static final int NUM_FILES
private static final int NUM_KB
private ManagerIF mgr
private java.lang.String myName
private SinkIF mySink
private ssTimer timer
private GnutellaServer gs
private java.util.Hashtable packetTable
private int num_connections
Constructor Detail |
---|
public SimpleGnutellaServer()
Method Detail |
---|
public void init(ConfigDataIF config) throws java.lang.Exception
EventHandlerIF
init
in interface EventHandlerIF
config
- The set of configuration parameters for the stage.
java.lang.Exception
- The EventHandler can indicate an
error to the runtime during initialization by throwing an
Exception.public void destroy()
EventHandlerIF
destroy
in interface EventHandlerIF
private void doCatcher()
private void forwardPacketToAll(GnutellaPacket pkt)
private void forwardPacket(GnutellaPacket pkt)
private boolean rememberPacket(GnutellaPacket pkt)
public void handleEvent(QueueElementIF item)
handleEvent
in interface EventHandlerIF
public void handleEvents(QueueElementIF[] items)
EventHandlerIF
handleEvents
in interface EventHandlerIF
private void doClean(SimpleGnutellaServer.timerEvent ev)
private void doTimer(SimpleGnutellaServer.timerEvent ev)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |