Skip to content

Commit bbb027b

Browse files
committed
smartx-dotnet version 1.5.0
1 parent 4e0f3b6 commit bbb027b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1593
-830
lines changed

Base/Network/Channel/KCP/KService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public void Recv()
130130
{
131131
messageLength = this.socket.ReceiveFrom(this.cache, ref this.tempRemoteEndPoint);
132132
}
133-
catch (Exception e)
133+
catch (Exception)
134134
{
135135
//Log.Error(e);
136136
continue;

Base/Network/Channel/WebSocket/HttpService.cs

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,32 @@ public override void Remove(long id)
5353
}
5454

5555
public override void Update()
56-
{
56+
{
57+
if(httpListener==null)
58+
{
59+
StartAccept(this.prefix);
60+
}
61+
5762
}
5863

64+
TimePass timepass = new TimePass(0,5*60);
65+
HttpListener httpListener = null;
5966
public void StartAccept(string uriPrefix)
6067
{
61-
HttpListener httpListener = new HttpListener();
68+
httpListener = new HttpListener();
6269
httpListener.AuthenticationSchemes = AuthenticationSchemes.Anonymous;
6370
httpListener.Prefixes.Add(uriPrefix);
6471
httpListener.Start();
6572
new Thread(new ThreadStart(delegate
6673
{
67-
while (true)
74+
while (!timepass.IsPassSet())
6875
{
6976
HttpListenerContext httpListenerContext = httpListener.GetContext();
7077
Result(httpListenerContext);
7178
}
79+
httpListener.Abort();
80+
httpListener.Close();
81+
httpListener = null;
7282
})).Start();
7383
}
7484

@@ -166,6 +176,11 @@ private string OnGet(HttpListenerRequest request, HttpListenerResponse response)
166176
if (RawUrl.IndexOf(".html?") != -1)
167177
RawUrl = RawUrl.Split('?')[0];
168178

179+
// 安全检查
180+
var fileInfo = new FileInfo("./wwwroot" + RawUrl);
181+
if (fileInfo.DirectoryName.IndexOf(System.Environment.CurrentDirectory+"\\wwwroot")==-1)
182+
return "";
183+
169184
string RawUrlFileText = null;
170185
if (File.Exists("./wwwroot" + RawUrl))
171186
RawUrlFileText = File.ReadAllText( "./wwwroot" + RawUrl);
@@ -226,16 +241,16 @@ private string OnMessage(Dictionary<string, string> map, HttpListenerRequest req
226241
message.request = request;
227242
message.response = response;
228243

229-
System.Threading.Monitor.Enter(Entity.Root);
230-
try
244+
lock (Entity.Root)
231245
{
232-
componentNetMsg.HandleMsg(null, NetOpcodeBase.HttpMessage, message);
233-
}
234-
catch(Exception e)
235-
{
236-
246+
try
247+
{
248+
componentNetMsg.HandleMsg(null, NetOpcodeBase.HttpMessage, message);
249+
}
250+
catch (Exception)
251+
{
252+
}
237253
}
238-
System.Threading.Monitor.Exit(Entity.Root);
239254
return message.result;
240255
}
241256

Bin/Base.dll

0 Bytes
Binary file not shown.

Bin/Base.pdb

52 Bytes
Binary file not shown.

Bin/Core.deps.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
"compilationOptions": {},
77
"targets": {
88
".NETCoreApp,Version=v3.1": {
9-
"Core/1.0.0": {
9+
"Core/1.5.0": {
1010
"dependencies": {
1111
"Base": "1.0.0",
1212
"LevelDB.Standard": "2.1.6.1",
1313
"MongoDB.Driver": "2.11.2",
1414
"MongoDB.Driver.Core": "2.11.2",
1515
"SauceControl.Blake2Fast": "2.0.0",
16+
"System.Runtime.Numerics": "4.3.0",
1617
"Tangram.Ed25519": "1.0.0",
1718
"JsonFx.Json": "1.4.1003.3007"
1819
},
@@ -950,7 +951,7 @@
950951
}
951952
},
952953
"libraries": {
953-
"Core/1.0.0": {
954+
"Core/1.5.0": {
954955
"type": "project",
955956
"serviceable": false,
956957
"sha512": ""

Bin/Core.dll

26.5 KB
Binary file not shown.

Bin/Core.exe

0 Bytes
Binary file not shown.

Bin/Core.pdb

14.8 KB
Binary file not shown.

Bin/Google.Protobuf.dll

0 Bytes
Binary file not shown.

Bin/Google.Protobuf.pdb

-24 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)