Browse Source

fix pac watching

tags/2.3
clowwindy 10 years ago
parent
commit
53dab0a049
1 changed files with 3 additions and 5 deletions
  1. +3
    -5
      shadowsocks-csharp/Controller/PACServer.cs

+ 3
- 5
shadowsocks-csharp/Controller/PACServer.cs View File

@@ -29,10 +29,11 @@ namespace Shadowsocks.Controller
// Bind the socket to the local endpoint and listen for incoming connections. // Bind the socket to the local endpoint and listen for incoming connections.
listener.Bind(localEndPoint); listener.Bind(localEndPoint);
listener.Listen(100); listener.Listen(100);
listener.BeginAccept( listener.BeginAccept(
new AsyncCallback(AcceptCallback), new AsyncCallback(AcceptCallback),
listener); listener);
watchPACFile();
} }
public string TouchPACFile() public string TouchPACFile()
@@ -70,11 +71,8 @@ namespace Shadowsocks.Controller
private string getPACContent() private string getPACContent()
{ {
// TODO try pac.txt in current directory
if (File.Exists(PAC_FILE)) if (File.Exists(PAC_FILE))
{ {
watchPACFile();
return File.ReadAllText(PAC_FILE, Encoding.UTF8); return File.ReadAllText(PAC_FILE, Encoding.UTF8);
} }
else else
@@ -94,7 +92,7 @@ namespace Shadowsocks.Controller
return System.Text.Encoding.UTF8.GetString(buffer, 0, n); return System.Text.Encoding.UTF8.GetString(buffer, 0, n);
} }
} }
watchPACFile();
} }
private void receiveCallback(IAsyncResult ar) private void receiveCallback(IAsyncResult ar)


Loading…
Cancel
Save