Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
srvpro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
srvpro
Commits
2396832c
Commit
2396832c
authored
Jan 09, 2017
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
54f06e4d
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
132 deletions
+82
-132
ygopro-server.coffee
ygopro-server.coffee
+2
-25
ygopro-server.js
ygopro-server.js
+80
-107
No files found.
ygopro-server.coffee
View file @
2396832c
...
@@ -144,25 +144,6 @@ get_memory_usage = ()->
...
@@ -144,25 +144,6 @@ get_memory_usage = ()->
percentUsed
=
0
percentUsed
=
0
return
percentUsed
return
percentUsed
# 定时清理关闭的连接
# the server write data directly to the socket object
# so this is a dumb way to clean data
Graveyard
=
[]
tribute
=
(
socket
)
->
setTimeout
((
socket
)
->
Graveyard
.
push
(
socket
);
return
),
3000
,
socket
return
setInterval
()
->
for
fuck
,
i
in
Graveyard
Graveyard
[
i
].
destroy
()
if
Graveyard
[
i
]
for
you
,
j
in
Graveyard
[
i
]
Graveyard
[
i
][
j
]
=
null
Graveyard
[
i
]
=
null
Graveyard
=
[]
return
,
3000
Cloud_replay_ids
=
[]
Cloud_replay_ids
=
[]
ROOM_all
=
[]
ROOM_all
=
[]
...
@@ -608,7 +589,6 @@ net.createServer (client) ->
...
@@ -608,7 +589,6 @@ net.createServer (client) ->
connect_count
--
connect_count
--
ROOM_connected_ip
[
client
.
ip
]
=
connect_count
ROOM_connected_ip
[
client
.
ip
]
=
connect_count
#log.info "disconnect", client.ip, ROOM_connected_ip[client.ip]
#log.info "disconnect", client.ip, ROOM_connected_ip[client.ip]
#tribute(client)
unless
client
.
closed
unless
client
.
closed
client
.
closed
=
true
client
.
closed
=
true
room
.
disconnect
(
client
)
if
room
room
.
disconnect
(
client
)
if
room
...
@@ -623,7 +603,6 @@ net.createServer (client) ->
...
@@ -623,7 +603,6 @@ net.createServer (client) ->
connect_count
--
connect_count
--
ROOM_connected_ip
[
client
.
ip
]
=
connect_count
ROOM_connected_ip
[
client
.
ip
]
=
connect_count
#log.info "err disconnect", client.ip, ROOM_connected_ip[client.ip]
#log.info "err disconnect", client.ip, ROOM_connected_ip[client.ip]
#tribute(client)
unless
client
.
closed
unless
client
.
closed
client
.
closed
=
error
client
.
closed
=
error
room
.
disconnect
(
client
,
error
)
if
room
room
.
disconnect
(
client
,
error
)
if
room
...
@@ -638,7 +617,6 @@ net.createServer (client) ->
...
@@ -638,7 +617,6 @@ net.createServer (client) ->
#log.info "server closed", client.name, had_error
#log.info "server closed", client.name, had_error
room
=
ROOM_all
[
client
.
rid
]
room
=
ROOM_all
[
client
.
rid
]
#log.info "server close", client.ip, ROOM_connected_ip[client.ip]
#log.info "server close", client.ip, ROOM_connected_ip[client.ip]
#tribute(server)
room
.
disconnector
=
'server'
if
room
room
.
disconnector
=
'server'
if
room
server
.
closed
=
true
unless
server
.
closed
server
.
closed
=
true
unless
server
.
closed
unless
client
.
closed
unless
client
.
closed
...
@@ -650,7 +628,6 @@ net.createServer (client) ->
...
@@ -650,7 +628,6 @@ net.createServer (client) ->
#log.info "server error", client.name, error
#log.info "server error", client.name, error
room
=
ROOM_all
[
client
.
rid
]
room
=
ROOM_all
[
client
.
rid
]
#log.info "server err close", client.ip, ROOM_connected_ip[client.ip]
#log.info "server err close", client.ip, ROOM_connected_ip[client.ip]
#tribute(server)
room
.
disconnector
=
'server'
if
room
room
.
disconnector
=
'server'
if
room
server
.
closed
=
error
server
.
closed
=
error
unless
client
.
closed
unless
client
.
closed
...
@@ -1370,8 +1347,8 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)->
...
@@ -1370,8 +1347,8 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)->
else
else
if
response
.
statusCode
!=
200
if
response
.
statusCode
!=
200
log
.
warn
'DECK POST FAIL'
,
response
.
statusCode
,
client
.
name
,
body
log
.
warn
'DECK POST FAIL'
,
response
.
statusCode
,
client
.
name
,
body
else
#
else
log
.
info
'DECK POST OK'
,
response
.
statusCode
,
client
.
name
,
body
#
log.info 'DECK POST OK', response.statusCode, client.name, body
return
return
client
.
deck_saved
=
true
client
.
deck_saved
=
true
return
return
...
...
ygopro-server.js
View file @
2396832c
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment