private void process()
{
OutputStream out;
InputStream in;
StreamLexer lexer;
try {
if (socket == null) {
socket = new Socket(host, port);
} else { // FIX: if (!socket.isConnected()) {
socket = new Socket(host, port);
}
connectState = CONNECTING;
} catch (IOException e) {
connectState = OFFLINE;
fireEvent(new ErrorEvent("giFT daemon not running", e));
fireEvent(new OfflineEvent());
return;
}
try {
out = socket.getOutputStream();
in = socket.getInputStream();
lexer = new StreamLexer(in);
Command cmd = new Command("attach");
cmd.addKey("client", "XNap");
cmd.addKey("version", XNap.VERSION);
if (user != null) {
cmd.addKey("profile", user);
}
queueCommand(cmd);
cmd = null;
while (!exitProcessThread) {
Thread.sleep(10);
if (false) { // FIX : !socket.isConnected()
break;
}
if (in.available() != 0) {
cmd = lexer.parse();
if (debug) {
fireEvent(new DebugEvent(DebugEvent.RECEIVE, cmd));
}