Methods Summary |
---|
protected void | disp(Packet p)
String[][] cmds;
int cmdSet = p.cmdSet;
int cmd = p.cmd;
int cmdSetIndex = cmdSet;
int cmdIndex = cmd;
if ( cmdSet < 64 ) {
cmds = VMcmds;
} else if ( cmdSet < 128 ) {
cmds = DBGcmds;
cmdSetIndex -= 64;
/*
* THIS IS LIKELY TO CAUSE PROBLEMS IN THE FUTURE
*/
cmdIndex -= 99;
} else {
cmds = VENcmds;
cmdSetIndex = cmdIndex = 0;
}
try {
Log.LOGN(3, "Sending through: " +
cmds[ cmdSetIndex ][ 0 ] + "(" + cmdSet + ")/" +
cmds[ cmdSetIndex ][ cmdIndex ] + "(" + cmd + ")" );
Log.LOGN(8, "Packet: " + p);
} catch ( ArrayIndexOutOfBoundsException e ) {
System.out.println( "UNKNOWN COMMAND: " + cmdSet + "/" + cmd );
}
|
public void | newPacket(Packet p)
if (p == null) {
quit();
synchronized(packetQueue) {
packetQueue.notify();
}
return;
}
synchronized(packetQueue) {
packetQueue.add(p);
packetQueue.notify();
}
|
public abstract void | quit()
|
void | replyReceived(Packet p)
Packet p2;
if (p == null) {
quit();
synchronized(waitingQueue) {
Iterator iter = waitingQueue.values().iterator();
while (iter.hasNext()) {
p2 = (Packet)iter.next();
p2.notify();
}
}
return;
}
String idString = String.valueOf(p.id);
synchronized(waitingQueue) {
p2 = (Packet)waitingQueue.get(idString);
if (p2 != null)
waitingQueue.remove(idString);
}
if (p2 == null) {
System.err.println("Received reply with no sender!");
return;
}
p2.errorCode = p.errorCode;
p2.data = p.data;
p2.replied = true;
synchronized(p2) {
p2.notify();
}
|
public abstract void | send(Packet p)
|
public void | verbose(int lvl)
verbose = lvl;
|
protected void | vp(int vlevel, java.lang.String str)
if ( verbose >= vlevel )
System.out.print( str );
|
protected void | vpe(int vlevel, java.lang.String str)
if ( verbose == vlevel )
vp( vlevel, str );
|
public Packet | waitForPacket()
synchronized(packetQueue) {
while (!timeToQuit && packetQueue.size() == 0) {
try {
packetQueue.wait();
} catch (InterruptedException e) {
}
}
}
if (timeToQuit)
return null;
return ((Packet)packetQueue.remove(0));
|
public void | waitForReply(Packet p)
synchronized(p) {
while (!timeToQuit && !p.replied) {
try { p.wait();
} catch (InterruptedException e) {
}
}
if (!p.replied)
throw new RuntimeException();
}
|