|
@@ -165,7 +165,7 @@ namespace EVCB_OCPP.WSServer
|
|
|
};
|
|
|
private CancellationTokenSource _cts = new CancellationTokenSource();
|
|
|
private CancellationToken _ct;
|
|
|
- //private Semaphore bootSemaphore = new Semaphore(10, 10);
|
|
|
+ private Semaphore bootSemaphore = new Semaphore(10, 10);
|
|
|
#endregion
|
|
|
|
|
|
internal Dictionary<string, WsClientData> GetClientDic()
|
|
@@ -723,7 +723,7 @@ namespace EVCB_OCPP.WSServer
|
|
|
session.ChargePointVendor = bootNotificationRequest.chargePointVendor;
|
|
|
|
|
|
if (session.BootStatus == BootStatus.Startup
|
|
|
- //&& bootSemaphore.WaitOne(0)
|
|
|
+ && bootSemaphore.WaitOne(0)
|
|
|
)
|
|
|
{
|
|
|
session.BootStatus = BootStatus.Initializing;
|
|
@@ -1017,9 +1017,19 @@ namespace EVCB_OCPP.WSServer
|
|
|
|
|
|
private async Task StartInitializeEVSE(WsClientData session)
|
|
|
{
|
|
|
- await InitializeEVSE(session);
|
|
|
- session.BootStatus = BootStatus.Pending;
|
|
|
- //bootSemaphore.Release();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ await InitializeEVSE(session);
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ logger.LogCritical("StartInitializeEVSE:{errormsg}", e.Message);
|
|
|
+ }
|
|
|
+ finally
|
|
|
+ {
|
|
|
+ session.BootStatus = BootStatus.Pending;
|
|
|
+ bootSemaphore.Release();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private async Task InitializeEVSE(WsClientData session)
|
|
@@ -1059,8 +1069,10 @@ namespace EVCB_OCPP.WSServer
|
|
|
session.ChargeBoxId, key: "StopTransactionOnInvalidId", value: "True");
|
|
|
}
|
|
|
|
|
|
- foreach (var initFunction in InitActions)
|
|
|
+ //foreach (var initFunction in InitActions)
|
|
|
+ for (var index = 0; index < InitActions.Count; index++)
|
|
|
{
|
|
|
+ var initFunction = InitActions[index];
|
|
|
await initFunction(session, session.DisconnetCancellationToken);
|
|
|
}
|
|
|
//await StationConfigService?.CheckAndUpdateEvseConfig(session, session.DisconnetCancellationToken);
|