fixes file saving &
code format
This commit is contained in:
parent
7b14144193
commit
be9889be59
3 changed files with 12 additions and 12 deletions
|
|
@ -153,9 +153,7 @@ namespace Yavsc.Services
|
||||||
buffer = new byte[Constants.WebSocketsMaxBufLen+16];
|
buffer = new byte[Constants.WebSocketsMaxBufLen+16];
|
||||||
sBuffer = new ArraySegment<byte>(buffer);
|
sBuffer = new ArraySegment<byte>(buffer);
|
||||||
received = await liveHandler.Socket.ReceiveAsync(sBuffer, liveHandler.TokenSource.Token);
|
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];
|
count = (received.Count<4)? 0 : buffer[0]*256*1024 +buffer[1]*1024+buffer[2]*256 + buffer[3];
|
||||||
|
|
||||||
_logger.LogInformation($"Received bytes : {count}");
|
_logger.LogInformation($"Received bytes : {count}");
|
||||||
_logger.LogInformation($"Is the end : {received.EndOfMessage}");
|
_logger.LogInformation($"Is the end : {received.EndOfMessage}");
|
||||||
if (received.Count<=4 || count > Constants.WebSocketsMaxBufLen) {
|
if (received.Count<=4 || count > Constants.WebSocketsMaxBufLen) {
|
||||||
|
|
|
||||||
|
|
@ -51,13 +51,12 @@ namespace Yavsc.ViewModels.Streaming
|
||||||
usage -= fi.Length;
|
usage -= fi.Length;
|
||||||
}
|
}
|
||||||
logger.LogInformation("Opening the file");
|
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");
|
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();
|
var buffer = queue.Dequeue();
|
||||||
int count = buffer.Array[0]*256*1024 +buffer.Array[1]*1024+buffer.Array[2]*256 + buffer.Array[3];
|
int count = buffer.Array[0]*256*1024 +buffer.Array[1]*1024+buffer.Array[2]*256 + buffer.Array[3];
|
||||||
|
|
||||||
|
|
@ -73,13 +72,13 @@ namespace Yavsc.ViewModels.Streaming
|
||||||
var packetInfo = JsonConvert.SerializeObject(buffer);
|
var packetInfo = JsonConvert.SerializeObject(buffer);
|
||||||
logger.LogError($"didn´t wrote {count} bytes from {buffer.Array.Length}!\n{packetInfo}");
|
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;
|
if (usage >= user.DiskQuota) break;
|
||||||
logger.LogInformation($"Waitting 200ms.");
|
if (queue.Count==0 && !isEndOfInput()) {
|
||||||
await Task.Delay(100);
|
logger.LogInformation($"Waitting 200ms.");
|
||||||
logger.LogInformation($"Done waiting");
|
await Task.Delay(100);
|
||||||
|
logger.LogInformation($"Done waiting");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
user.DiskUsage = usage;
|
user.DiskUsage = usage;
|
||||||
dest.Close();
|
dest.Close();
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,14 @@ msbuild-restore:
|
||||||
|
|
||||||
check: run
|
check: run
|
||||||
|
|
||||||
|
|
||||||
project.lock.json: project.json
|
project.lock.json: project.json
|
||||||
dnu restore
|
dnu restore
|
||||||
@# fixing package id reference case, to System.Xml, from package NJsonSchema.CodeGeneration.CSharp
|
@# 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
|
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
|
$(BINTARGETPATH): project.lock.json
|
||||||
|
|
||||||
run: $(BINTARGETPATH)
|
run: $(BINTARGETPATH)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue