after creation.
Becuase we put handler.Start() call after timeout check and
lastActivity is initialized in Start(), this will lead to a
incorrect timeout.
Also because we will call handler.Start() right after the
constructor and timeout check, so it makes no difference
where we put the initializtion of lastActivity. We won't do
this again in Start() because DateTime.Now will consumes a
lot of cpu time.
When using http proxy, this will cause distinct latency
if we are trying to resolve localhost.
Currently it's unnecessary to do that because our privoxy
doesn't listern on ipv6 address, so it's ok to hard code
the ipv4 address.
There is a plan to add a cache to record the ipv6 connectivity
so that we needn't to try both ipv4 and ipv6 every time when we
attempt to connect a DnsEndPoint.
Design:
Use the plain string for both config and hotkey parsing
and make use of KeyConverter, ModifierKeysConverter
to make it more rubust.
Find corresponding label (to display operation result) and callback (to do the real work) based on textbox name. In this case, they should be named as `<Feature-Name><Control-Name>`.
ShowLogsTextBox,
ShowLogsLabel,
ShowLogsCallback.
If this requirement doesn't meet, throw an exception at runtime.
Logic:
How to input keys:
1. put focus in the corresponding textbox
2. press the key combination you want to use
3. when you think it is ready, release all keys
4. the textbox shows your input
How to change keys:
1. put focus in the corresponding textbox
2. press BackSpace to clear content
3. re-input new one
How to deactivate:
1. clear content in the textbox
2. press OK button
Meaning of label color:
- Green: this combination is not occupied by other programs and register successfully
- Yellow: this combination is occupied by other programs and you have to change to another one
- Transparent without color: initial status
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
- Revert bandwidthScale when throughput gets smaller
- Don't save coordinates when LogForm is minimized. Otherwise, we get negative values
- activate ConfigForm & ProxyForm & LogForm
User wants to use that server after selected it in the ConfigForm. If user deletes
the server in use, we can't find its index, then the previous logic will revert to
index 0, which is not expected behaviour.
Since we handled 'ServersListBox.SelectedIndex' in various event handlers, we can
trust it all the time.
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
Lock is evil.
This will actually affect the accuracy of GetDelta because
inboundDelta and outboundDelta may be calculated based on
the data collected at different time (eg. UpdateOutbound
get called before Interlocked.Read(ref _outbound)).
But that's not a problem. We can tolerate this little
inaccuracy. Besides, the _inbound, _outbound, _lastInbound
and _lastOutbound will be totally good because we use Interlocked.
To prevent "The IAsyncResult object was not returned from
the corresponding asynchronous method on this class." exception.
Signed-off-by: noisyfox <timemanager.rick@gmail.com>
Socket.ConnectAsync will create socket and handle the address family
itself. This solves some compatibility issues on win7.
Signed-off-by: noisyfox <timemanager.rick@gmail.com>