Tuning Profiles and Beepcore
William Berriel <[email protected]> Mon, 10 Mar 2003 01:33:28 -0800
| Newsgroups | gmane.network.beep.beepcore.java.general |
|---|---|
| Message-ID | <[email protected]> |
Hi, For the purposes of creating a Tunnel Profile, I need to have the session perform a tuning reset while not actually changing the socket. I have used pretty much the exact code found in the two TLS profiles for the tuning reset, yet when I use Beepd and Bing (unchanged, except for the names of the profiles used), the client does not recognize the reply to it's request to start an echo profile after the the tuning reset has occurred. Can anyone give me hints as to why this is happening? The code for the startTunnel and startChannel functions are enclosed. startTunnel is used by a client to start a tunnel, startChannel is called by the session, I believe. thanks, William Berriel
tunnelfunctions.text.txt
(text/plain, 2.8 KB)
public void startChannel(Channel channel, String encoding, String data)
throws StartChannelException
{
TCPSession session = (TCPSession)channel.getSession();
String replyData = null;
if(data != null) {
if(data.equalsIgnoreCase(EMPTY) || data.equalsIgnoreCase(EMPTY2)){
replyData = OK;
try {
this.begin(channel, URI, replyData);
// Consider the Profile Registry
ProfileRegistry preg = session.getProfileRegistry();
preg.removeStartChannelListener(URI);
Hashtable hash = new Hashtable();
hash.put("TUNNEL", "true");
SessionTuningProperties tuning =
new SessionTuningProperties(hash);
// Cause the session to be recreated and reset
this.complete(channel, session.getLocalCredential(),
session.getPeerCredential(), tuning,
preg, session.getSocket());
} catch (Exception e) {
System.err.println("We got a problem in tuning reset : " +
e.getMessage());
}
System.out.println("tunnel made");
}
}
System.err.println("Setting message listener to this");
channel.setMessageListener(this);
}
public TCPSession startTunnel(TCPSession session, String data)
throws BEEPException
{
// final argument is the messagelistener to handle the incoming
// messages, change this to ourselves once our profile can handle
// non piggy-backed messages
Channel ch = startChannel(session, URI, false, data, null);
String startData = ch.getStartData();
if (startData != null){
if(!startData.equalsIgnoreCase(OK)){
System.err.println("We got back a bad message: " +
startData);
throw new BEEPException("Bad Start Data : " + startData);
}
Hashtable hash = new Hashtable();
hash.put("TUNNEL", "true");
SessionTuningProperties tuning=
new SessionTuningProperties(hash);
return (TCPSession) reset(session,
session.getLocalCredential(),
session.getPeerCredential(),
tuning,
session.getProfileRegistry(),
session.getSocket());
}
System.err.println("Didn't get an OK! ");
throw new BEEPException("Didn't get ok!");
}