@@ -35,6 +35,7 @@ public class Cluster : RunnableBase
3535 protected IStorage storage ;
3636 protected AccessCounter counter ;
3737 public CancellationTokenSource cancellationSrc = new CancellationTokenSource ( ) ;
38+ public WebApplication ? application = null ;
3839 //List<Task> tasks = new List<Task>();
3940
4041 public Cluster ( ClusterInfo info , TokenManager token ) : base ( )
@@ -91,11 +92,10 @@ protected async Task<int> AsyncRun()
9192 await GetConfiguration ( ) ;
9293 // 检查文件
9394 await CheckFiles ( ) ;
94-
95+ SharedData . Logger . LogInfo ( ) ;
9596 Connect ( ) ;
9697
9798 await RequestCertification ( ) ;
98- //t.Start();
9999
100100 InitializeService ( ) ;
101101
@@ -130,16 +130,16 @@ private void InitializeService()
130130 listenOptions . UseHttps ( cert ) ;
131131 } ) ;
132132 } ) ;
133- var app = builder . Build ( ) ;
133+ application = builder . Build ( ) ;
134134 var path = $ "{ SharedData . Config . clusterFileDirectory } cache";
135- app . UseStaticFiles ( ) ;
136- app . MapGet ( "/download/{hash}" , async ( context ) =>
135+ application . UseStaticFiles ( ) ;
136+ application . MapGet ( "/download/{hash}" , async ( context ) =>
137137 {
138138 FileAccessInfo fai = await HttpServerUtils . DownloadHash ( context , this . storage ) ;
139139 this . counter . Add ( fai ) ;
140140 } ) ;
141- app . MapGet ( "/measure/{size}" , ( context ) => HttpServerUtils . Measure ( context ) ) ;
142- Task task = app . RunAsync ( ) ;
141+ application . MapGet ( "/measure/{size}" , ( context ) => HttpServerUtils . Measure ( context ) ) ;
142+ Task task = application . RunAsync ( ) ;
143143 Utils . tasks . Add ( Task . Run ( async ( ) =>
144144 {
145145 Thread . Sleep ( 1000 ) ;
0 commit comments