fixes file saving &
code format
This commit is contained in:
@ -153,9 +153,7 @@ namespace Yavsc.Services
|
||||
buffer = new byte[Constants.WebSocketsMaxBufLen+16];
|
||||
sBuffer = new ArraySegment<byte>(buffer);
|
||||
received = await liveHandler.Socket.ReceiveAsync(sBuffer, liveHandler.TokenSource.Token);
|
||||
|
||||
count = (received.Count<4)? 0 : buffer[0]*256*1024 +buffer[1]*1024+buffer[2]*256 + buffer[3];
|
||||
|
||||
_logger.LogInformation($"Received bytes : {count}");
|
||||
_logger.LogInformation($"Is the end : {received.EndOfMessage}");
|
||||
if (received.Count<=4 || count > Constants.WebSocketsMaxBufLen) {
|
||||
|
@ -51,13 +51,12 @@ namespace Yavsc.ViewModels.Streaming
|
||||
usage -= fi.Length;
|
||||
}
|
||||
logger.LogInformation("Opening the file");
|
||||
using (var dest = fi.OpenWrite())
|
||||
using (var dest = fi.Open(FileMode.Create, FileAccess.Write, FileShare.Read))
|
||||
{
|
||||
logger.LogInformation("Appening to file");
|
||||
while (queue.Count>0)
|
||||
while (!isEndOfInput() || queue.Count>0)
|
||||
{
|
||||
while (queue.Count>0)
|
||||
{
|
||||
if (queue.Count>0) {
|
||||
var buffer = queue.Dequeue();
|
||||
int count = buffer.Array[0]*256*1024 +buffer.Array[1]*1024+buffer.Array[2]*256 + buffer.Array[3];
|
||||
|
||||
@ -72,14 +71,14 @@ namespace Yavsc.ViewModels.Streaming
|
||||
else {
|
||||
var packetInfo = JsonConvert.SerializeObject(buffer);
|
||||
logger.LogError($"didn´t wrote {count} bytes from {buffer.Array.Length}!\n{packetInfo}");
|
||||
}
|
||||
if (usage >= user.DiskQuota) break;
|
||||
}
|
||||
}
|
||||
if (isEndOfInput()) break;
|
||||
if (usage >= user.DiskQuota) break;
|
||||
logger.LogInformation($"Waitting 200ms.");
|
||||
await Task.Delay(100);
|
||||
logger.LogInformation($"Done waiting");
|
||||
if (queue.Count==0 && !isEndOfInput()) {
|
||||
logger.LogInformation($"Waitting 200ms.");
|
||||
await Task.Delay(100);
|
||||
logger.LogInformation($"Done waiting");
|
||||
}
|
||||
}
|
||||
user.DiskUsage = usage;
|
||||
dest.Close();
|
||||
|
@ -12,11 +12,14 @@ msbuild-restore:
|
||||
|
||||
check: run
|
||||
|
||||
|
||||
project.lock.json: project.json
|
||||
dnu restore
|
||||
@# fixing package id reference case, to System.Xml, from package NJsonSchema.CodeGeneration.CSharp
|
||||
sed 's/System.XML/System.Xml/' project.lock.json > project.lock.json.new && mv project.lock.json.new project.lock.json
|
||||
|
||||
restore: project.lock.json
|
||||
|
||||
$(BINTARGETPATH): project.lock.json
|
||||
|
||||
run: $(BINTARGETPATH)
|
||||
|
Reference in New Issue
Block a user