Created
July 1, 2012 14:04
-
-
Save BrunoBonacci/3028525 to your computer and use it in GitHub Desktop.
Vert.x Simple Telnet Server - session management
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is the base directory where all user will be segregated (like: "chroot") | |
BASE_DIR = new File(System.properties.baseDir ?: "/tmp").canonicalPath; | |
// This map maintains the session state for every connection. | |
// for this telnet server the state will be limited to the current directory | |
_connections = [:]; | |
// Connection id counter | |
_cids = 0; | |
// assigning an id to a new connection | |
def registerConnection() { | |
String cid = "${++_cids}" | |
_connections[cid] = [curDir: BASE_DIR] | |
return cid; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment