Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Titanium-Web-Proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Titanium-Web-Proxy
Commits
1edcb327
Commit
1edcb327
authored
Oct 19, 2020
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup
parent
20ef5aec
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
ProxyTestController.cs
.../Titanium.Web.Proxy.Examples.Basic/ProxyTestController.cs
+6
-5
No files found.
examples/Titanium.Web.Proxy.Examples.Basic/ProxyTestController.cs
View file @
1edcb327
...
...
@@ -17,15 +17,16 @@ namespace Titanium.Web.Proxy.Examples.Basic
{
public
class
ProxyTestController
:
IDisposable
{
private
readonly
SemaphoreSlim
@lock
=
new
SemaphoreSlim
(
1
);
private
readonly
ProxyServer
proxyServer
;
private
ExplicitProxyEndPoint
explicitEndPoint
;
private
CancellationTokenSource
cancellationTokenSource
=
new
CancellationTokenSource
();
private
CancellationToken
cancellationToken
=>
cancellationTokenSource
.
Token
;
private
ConcurrentQueue
<
Tuple
<
ConsoleColor
?,
string
>>
consoleMessageQueue
;
private
ConcurrentQueue
<
Tuple
<
ConsoleColor
?,
string
>>
consoleMessageQueue
=
new
ConcurrentQueue
<
Tuple
<
ConsoleColor
?,
string
>>();
public
ProxyTestController
()
{
consoleMessageQueue
=
new
ConcurrentQueue
<
Tuple
<
ConsoleColor
?,
string
>>();
Task
.
Run
(()=>
listenToConsole
());
proxyServer
=
new
ProxyServer
();
...
...
@@ -415,7 +416,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
{
while
(!
cancellationToken
.
IsCancellationRequested
)
{
if
(
consoleMessageQueue
.
TryDequeue
(
out
var
item
))
while
(
consoleMessageQueue
.
TryDequeue
(
out
var
item
))
{
var
consoleColor
=
item
.
Item1
;
var
message
=
item
.
Item2
;
...
...
@@ -434,7 +435,7 @@ namespace Titanium.Web.Proxy.Examples.Basic
}
//reduce CPU usage
await
Task
.
Delay
(
1
0
);
await
Task
.
Delay
(
5
0
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment