use a unique id for each client

Mentioned in #36.
This commit is contained in:
Gokcehan committed 2016-11-06 01:49:45 +03:00
1 parent e753b5b159
commit d622e74c51
1 file changed
+8 -2
+8 -2
View File
@@ -20,6 +20,7 @@ var (
)
var (
gClientId int
gLastDirPath string
gSelectionPath string
gSocketPath string
@@ -50,8 +51,13 @@ func init() {
gSocketPath = filepath.Join(tmp, fmt.Sprintf("lf.%s.sock", envUser))
// TODO: unique log file for each client
gLogPath = filepath.Join(tmp, fmt.Sprintf("lf.%s.log", envUser))
gClientId = 1000
gLogPath = filepath.Join(tmp, fmt.Sprintf("lf.%s.%d.log", envUser, gClientId))
for _, err := os.Stat(gLogPath); err == nil; _, err = os.Stat(gLogPath) {
gClientId++
gLogPath = filepath.Join(tmp, fmt.Sprintf("lf.%s.%d.log", envUser, gClientId))
}
gServerLogPath = filepath.Join(tmp, fmt.Sprintf("lf.%s.server.log", envUser))
gConfigPath = filepath.Join(envConfig, "lf", "lfrc")