Browse Source

cleaning

pull/123/head
notgiven688 3 years ago
parent
commit
e906f70c7c
4 changed files with 17 additions and 47 deletions
  1. +0
    -20
      hash_cn/webassembly/xmr/cryptonight.c
  2. +11
    -23
      server/Server/Fleck/WebSocketConnection.cs
  3. +1
    -1
      server/Server/PoolConnection.cs
  4. +5
    -3
      server/Server/Program.cs

+ 0
- 20
hash_cn/webassembly/xmr/cryptonight.c View File

@ -405,26 +405,6 @@ void cryptonight_hash_ctx(void *output, const void *input, struct cryptonight_ct
for (i = 0; likely(i < ITER / 4); ++i)
{
/* the following german comment (it is rather a note) made it accidentally into this repository:
"ueberall, woe uint64 & ... steht, sollte prinzipiell auch uint32 möglich sein.
auch aeon checken."
Note: the first "woe" is actually a typo. It was meant to be just "wo".
The reason behind this comment is the somehow suspicious behavior of webassembly/emscripten
which generated different code for situations which are mathematically equivalent. Since we
are in a "performance-critical" part of the code I tested several of these theoretically equivalent
formulations.
The comment led to the following remarks on reddit:
- Leaked code! Someone at coinhive will be pissed :P
- If the code is of the same quality as your comment ... good (crypto)night.
- Seriously, why would you mix Üs and UEs on the same line?
*/
// Dependency chain: address -> read value ------+
// written value <-+ hard function (AES or MUL) <+
// next address <-+

+ 11
- 23
server/Server/Fleck/WebSocketConnection.cs View File

@ -127,33 +127,21 @@ namespace Fleck
public void StartReceiving()
{
List<byte> data = new List<byte>(ReadSize);
buffer = new byte[ReadSize];
Task.Run(async delegate
{
await Task.Delay(TimeSpan.FromSeconds(20));
List<byte> data = new List<byte>(ReadSize);
buffer = new byte[ReadSize];
//buffer = BufferPool.RequestBuffer();
if (!_closed && !_opened) {
Console.WriteLine("Closing/Disposing WebSocketConnection. Not able to perform handshake within 20s.");
CloseSocket ();
}
var t = Task.Run(async delegate
{
await Task.Delay(TimeSpan.FromSeconds(20));
if (!_closed && !_opened) {
Console.WriteLine("Closing/Disposing WebSocketConnection. Not able to perform handshake within 20s.");
CloseSocket ();
}
});
/* new Task(() =>
{
System.Threading.Thread.Sleep (10000);
if (!opened)
CloseSocket ();
}
).Start();*/
});
Read(data, buffer);
}

+ 1
- 1
server/Server/PoolConnection.cs View File

@ -246,7 +246,7 @@ namespace Server {
networkStream.BeginRead (mypc.ReceiveBuffer, 0, mypc.ReceiveBuffer.Length, new AsyncCallback (ReceiveCallback), mypc);
/* keep things stupid and simple */
// keep things stupid and simple
string msg0 = "{\"method\":\"login\",\"params\":{\"login\":\"";
string msg1 = "\",\"pass\":\"";

+ 5
- 3
server/Server/Program.cs View File

@ -29,7 +29,7 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Security.Cryptography.X509Certificates
using System.Security.Cryptography.X509Certificates;
using Fleck;
using TinyJson;
@ -796,6 +796,8 @@ namespace Server {
if (!string.IsNullOrEmpty (ipadr)) Firewall.Update (ipadr, Firewall.UpdateEntry.WrongHash);
RemoveClient (client.WebSocket.ConnectionInfo.Id);
} else {
if(performFullCheck)
Console.WriteLine ("{0}: got hash-checked", client.WebSocket.ConnectionInfo.Id.ToString ());
if (!string.IsNullOrEmpty (ipadr)) Firewall.Update (ipadr, Firewall.UpdateEntry.SolvedJob);
@ -953,7 +955,7 @@ namespace Server {
}
} catch(Exception ex) {
Console.WriteLine ("Error saving statistics.dat {0}", ex);
Console.WriteLine ("Error saving statistics.dat: {0}", ex);
}
try {
@ -972,7 +974,7 @@ namespace Server {
Console.WriteLine ("done.");
}
} catch(Exception ex) {
Console.WriteLine ("Error saving logins.dat {0}", ex);
Console.WriteLine ("Error saving logins.dat: {0}", ex);
}
try {

Loading…
Cancel
Save