Skip to content

Commit

Permalink
Correcting session lookup logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ssalevan committed Feb 24, 2017
1 parent bc1246d commit 8f7a540
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion run
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/bin/bash

java -jar ./target/qlink-0.1.0.jar "$@"
JVM_ARGS=(
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1899
)

java "${JVM_ARGS[@]}" -jar ./target/qlink-0.1.0.jar "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.jbrain.qlink.QLinkServer;
import org.jbrain.qlink.QSession;
import org.jbrain.qlink.cmd.action.*;
import org.jbrain.qlink.user.QHandle;

public class HabitatConnection {

Expand Down Expand Up @@ -63,11 +64,10 @@ public void run() {
for(i=0;i<len;i++) {
if(data[i]==QConnection.FRAME_END) {
// we have a valid packet, process.

if(_log.isDebugEnabled()) {
QConnection.trace("Received Habitat Packet: ",data,start,i-start);
}
// TODO: THIS IS A FAKE FORMAT //

// username:raw frame info
for (int j = start; j < i; ++j) {
if (data[j] == ':') {
Expand Down Expand Up @@ -112,10 +112,11 @@ public void run() {

private QSession findSession(String key) {
/* The actual key is a QHandle, so we need to do a more tedious search. */
String handleSessionLookupKey = new QHandle(key).getKey();
Map map = _qServer.getSessionMap();
for (Object o : map.entrySet()) {
Map.Entry e = (Map.Entry) (o);
if (key.equalsIgnoreCase(e.getKey().toString())) {
if (handleSessionLookupKey.equalsIgnoreCase(e.getKey().toString())) {
return (QSession) e.getValue();
}
}
Expand Down

0 comments on commit 8f7a540

Please sign in to comment.