Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

rpcserver: include username in name of pipe

Changeset 72a091dde1e2

Parent 77acf8df275e

by Adrian Buehlmann

Changes to 2 files · Browse files at 72a091dde1e2 Showing diff from parent 77acf8df275e Diff from another changeset...

 
21
22
23
24
 
 
 
25
26
27
 
21
22
23
 
24
25
26
27
28
29
@@ -21,7 +21,9 @@
 import winerror     -PIPENAME = r"\\.\pipe\TortoiseHgRpcServer-bc0c27107423" +PIPENAME = r"\\.\pipe\TortoiseHgRpcServer-bc0c27107423-" +PIPENAME += win32api.GetUserName() +  PIPEBUFSIZE = 4096    
 
18
19
20
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
23
24
 
 
 
 
 
25
26
27
28
 
29
30
31
 
32
33
34
 
18
19
20
 
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
 
46
47
48
 
49
50
51
52
@@ -18,17 +18,35 @@
   #include "Thgstatus.h"   -#define THG_PIPENAME "\\\\.\\pipe\\TortoiseHgRpcServer-bc0c27107423" +#include <vector> + + +std::string GetPipeName() +{ + DWORD size = 260; + std::vector<char> buf(size); + if (!::GetUserNameA(&buf[0], &size)) + return ""; + std::string res = "\\\\.\\pipe\\TortoiseHgRpcServer-bc0c27107423-"; + res += &buf[0]; + return res; +} +    int Thgstatus::update(const std::string& path)  { + static std::string pname = GetPipeName(); + + if (pname.empty()) + return 0; +   BOOL fSuccess;   DWORD cbRead;   - TDEBUG_TRACE("Thgstatus::update(" << path << ")"); + TDEBUG_TRACE("Thgstatus::update(" << path << ") for " << pname);     fSuccess = ::CallNamedPipeA( - THG_PIPENAME, (void*)path.c_str(), path.size(), 0, 0, &cbRead, + pname.c_str(), (void*)path.c_str(), path.size(), 0, 0, &cbRead,   200 /* ms */   );