Skip to content

Commit

Permalink
2
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangfaguo committed Mar 25, 2021
1 parent 6e6990d commit aea844c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
11 changes: 5 additions & 6 deletions IpProxy/CustomerHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class CustomerHandler : ISubscribe
{

[Subscribe("Ip.Test")]
public async Task Check(IpInfo info)
public void Check(IpInfo info)
{

try
Expand All @@ -27,15 +27,14 @@ public async Task Check(IpInfo info)
listBox2.TopIndex = listBox2.Items.Count - (int)(listBox2.Height / listBox2.ItemHeight);
var client = (HttpWebRequest)WebRequest.Create(info.remote);
var uri = new Uri(info.remote, UriKind.Absolute);
client.Timeout = 4000;
client.ReadWriteTimeout = 4000;
client.Timeout =3000;
client.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
client.UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36";
client.Host = uri.Host;
client.Referer = info.remote;
client.Proxy = new WebProxy(info.IP, info.Port);
sw.Start();
var rep = (HttpWebResponse)await client.GetResponseAsync();
var rep = (HttpWebResponse)client.GetResponse();
var stream = rep.GetResponseStream();
sw.Stop();
if (rep.ContentEncoding.ToLower().Contains("gzip"))
Expand All @@ -44,7 +43,7 @@ public async Task Check(IpInfo info)
}
using (var sm = new StreamReader(stream))
{
var str = await sm.ReadToEndAsync();
var str = sm.ReadToEnd();
if (System.Text.RegularExpressions.Regex.Match(str, info.Test).Success)
{
listBox1.Items.Add(string.Format("threed:{0} {1}:{2},times:{3},url:{4}", 0, info.IP, info.Port, sw.ElapsedMilliseconds, info.url));
Expand All @@ -54,7 +53,7 @@ public async Task Check(IpInfo info)

}
}
catch (TimeoutException e)
catch (WebException e)
{

}
Expand Down
1 change: 1 addition & 0 deletions Lending.KZKZ.EventBus.Cap/CapBusExtentions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public static IServiceCollection ConfigCap(this IServiceCollection ServiceCollec
b.ConnectionString = connectString;
b.Schema = capSchema ?? "cap";
});
options.ConsumerThreadCount = 10;
options.DefaultGroup = qouteName;
options.RegisterExtension(new CapOptionsExtension());
});
Expand Down
3 changes: 1 addition & 2 deletions Lending.KZKZ.EventBus.Cap/CapDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ public void EnqueueToPublish(MediumMessage message)

public void EnqueueToExecute(MediumMessage message, ConsumerExecutorDescriptor descriptor)
{
// _receivedChannel.Writer.TryWrite((message, descriptor));
var task = _executor.DispatchAsync(message, descriptor, _cts.Token).Result;
_executor.DispatchAsync(message, descriptor, _cts.Token).ConfigureAwait(false).GetAwaiter().GetResult();
}

public void Dispose()
Expand Down
2 changes: 2 additions & 0 deletions Lending.KZKZ.EventBus.Cap/CapMyRegistor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,11 @@ private void RegisterMessageProcessor(IConsumerClient client)
{
MediumMessage mediumMessage = _storage.StoreReceivedMessage(name, group, message);
mediumMessage.Origin = message;

TracingAfter(tracingTimestamp, transportMessage, _serverAddress);
_dispatcher.EnqueueToExecute(mediumMessage, executor);
client.Commit(sender);

}
}
catch (Exception e)
Expand Down

0 comments on commit aea844c

Please sign in to comment.