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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
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
nanahira
srvpro
Commits
306c62e1
Commit
306c62e1
authored
Dec 08, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix when room process killed
parent
97e06b51
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
12 deletions
+14
-12
ygopro-server.coffee
ygopro-server.coffee
+7
-6
ygopro-server.js
ygopro-server.js
+7
-6
No files found.
ygopro-server.coffee
View file @
306c62e1
...
@@ -979,6 +979,7 @@ class Room
...
@@ -979,6 +979,7 @@ class Room
try
try
@
process
=
spawn
'./ygopro'
,
param
,
{
cwd
:
'ygopro'
}
@
process
=
spawn
'./ygopro'
,
param
,
{
cwd
:
'ygopro'
}
@
process_pid
=
@
process
.
pid
@
process
.
on
'error'
,
(
err
)
=>
@
process
.
on
'error'
,
(
err
)
=>
_
.
each
@
players
,
(
player
)
->
_
.
each
@
players
,
(
player
)
->
ygopro
.
stoc_die
(
player
,
"${create_room_failed}"
)
ygopro
.
stoc_die
(
player
,
"${create_room_failed}"
)
...
@@ -2511,7 +2512,7 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)->
...
@@ -2511,7 +2512,7 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)->
deck_arena
=
deck_arena
+
'custom'
deck_arena
=
deck_arena
+
'custom'
#log.info "DECK LOG START", client.name, room.arena
#log.info "DECK LOG START", client.name, room.arena
if
settings
.
modules
.
deck_log
.
local
if
settings
.
modules
.
deck_log
.
local
deck_name
=
moment
().
format
(
'YYYY-MM-DD HH-mm-ss'
)
+
' '
+
room
.
process
.
pid
+
' '
+
client
.
pos
+
' '
+
client
.
ip
.
slice
(
7
)
+
' '
+
client
.
name
.
replace
(
/[\/\\\?\*]/g
,
'_'
)
deck_name
=
moment
().
format
(
'YYYY-MM-DD HH-mm-ss'
)
+
' '
+
room
.
process
_
pid
+
' '
+
client
.
pos
+
' '
+
client
.
ip
.
slice
(
7
)
+
' '
+
client
.
name
.
replace
(
/[\/\\\?\*]/g
,
'_'
)
fs
.
writeFile
settings
.
modules
.
deck_log
.
local
+
deck_name
+
'.ydk'
,
deck_text
,
'utf-8'
,
(
err
)
->
fs
.
writeFile
settings
.
modules
.
deck_log
.
local
+
deck_name
+
'.ydk'
,
deck_text
,
'utf-8'
,
(
err
)
->
if
err
if
err
log
.
warn
'DECK SAVE ERROR'
,
err
log
.
warn
'DECK SAVE ERROR'
,
err
...
@@ -3002,7 +3003,7 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server)->
...
@@ -3002,7 +3003,7 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server)->
duellog
=
{
duellog
=
{
time
:
dueltime
,
time
:
dueltime
,
name
:
room
.
name
+
(
if
settings
.
modules
.
tournament_mode
.
show_info
then
(
" (Duel:"
+
room
.
duel_count
+
")"
)
else
""
),
name
:
room
.
name
+
(
if
settings
.
modules
.
tournament_mode
.
show_info
then
(
" (Duel:"
+
room
.
duel_count
+
")"
)
else
""
),
roomid
:
room
.
process
.
pid
.
toString
(),
roomid
:
room
.
process
_
pid
.
toString
(),
cloud_replay_id
:
"R#"
+
room
.
cloud_replay_id
,
cloud_replay_id
:
"R#"
+
room
.
cloud_replay_id
,
replay_filename
:
replay_filename
,
replay_filename
:
replay_filename
,
roommode
:
room
.
hostinfo
.
mode
,
roommode
:
room
.
hostinfo
.
mode
,
...
@@ -3121,7 +3122,7 @@ if settings.modules.http
...
@@ -3121,7 +3122,7 @@ if settings.modules.http
else
else
response
.
writeHead
(
200
)
response
.
writeHead
(
200
)
roomsjson
=
JSON
.
stringify
rooms
:
(
for
room
in
ROOM_all
when
room
and
room
.
established
roomsjson
=
JSON
.
stringify
rooms
:
(
for
room
in
ROOM_all
when
room
and
room
.
established
roomid
:
room
.
process
.
pid
.
toString
(),
roomid
:
room
.
process
_
pid
.
toString
(),
roomname
:
if
pass_validated
then
room
.
name
else
room
.
name
.
split
(
'$'
,
2
)[
0
],
roomname
:
if
pass_validated
then
room
.
name
else
room
.
name
.
split
(
'$'
,
2
)[
0
],
roommode
:
room
.
hostinfo
.
mode
,
roommode
:
room
.
hostinfo
.
mode
,
needpass
:
(
room
.
name
.
indexOf
(
'$'
)
!=
-
1
).
toString
(),
needpass
:
(
room
.
name
.
indexOf
(
'$'
)
!=
-
1
).
toString
(),
...
@@ -3272,7 +3273,7 @@ if settings.modules.http
...
@@ -3272,7 +3273,7 @@ if settings.modules.http
else
if
u
.
query
.
kick
else
if
u
.
query
.
kick
kick_room_found
=
false
kick_room_found
=
false
for
room
in
ROOM_all
when
room
and
room
.
established
and
(
u
.
query
.
kick
==
"all"
or
u
.
query
.
kick
==
room
.
process
.
pid
.
toString
()
or
u
.
query
.
kick
==
room
.
name
)
for
room
in
ROOM_all
when
room
and
room
.
established
and
(
u
.
query
.
kick
==
"all"
or
u
.
query
.
kick
==
room
.
process
_
pid
.
toString
()
or
u
.
query
.
kick
==
room
.
name
)
kick_room_found
=
true
kick_room_found
=
true
if
room
.
started
if
room
.
started
room
.
scores
[
room
.
dueling_players
[
0
].
name_vpass
]
=
0
room
.
scores
[
room
.
dueling_players
[
0
].
name_vpass
]
=
0
...
@@ -3288,7 +3289,7 @@ if settings.modules.http
...
@@ -3288,7 +3289,7 @@ if settings.modules.http
else
if
u
.
query
.
death
else
if
u
.
query
.
death
death_room_found
=
false
death_room_found
=
false
for
room
in
ROOM_all
when
room
and
room
.
established
and
room
.
started
and
!
room
.
death
and
(
u
.
query
.
death
==
"all"
or
u
.
query
.
death
==
room
.
process
.
pid
.
toString
()
or
u
.
query
.
death
==
room
.
name
)
for
room
in
ROOM_all
when
room
and
room
.
established
and
room
.
started
and
!
room
.
death
and
(
u
.
query
.
death
==
"all"
or
u
.
query
.
death
==
room
.
process
_
pid
.
toString
()
or
u
.
query
.
death
==
room
.
name
)
death_room_found
=
true
death_room_found
=
true
oppo_pos
=
if
room
.
hostinfo
.
mode
==
2
then
2
else
1
oppo_pos
=
if
room
.
hostinfo
.
mode
==
2
then
2
else
1
if
!
room
.
changing_side
and
(
!
room
.
duel_count
or
room
.
turn
)
if
!
room
.
changing_side
and
(
!
room
.
duel_count
or
room
.
turn
)
...
@@ -3332,7 +3333,7 @@ if settings.modules.http
...
@@ -3332,7 +3333,7 @@ if settings.modules.http
else
if
u
.
query
.
deathcancel
else
if
u
.
query
.
deathcancel
death_room_found
=
false
death_room_found
=
false
for
room
in
ROOM_all
when
room
and
room
.
established
and
room
.
started
and
room
.
death
and
(
u
.
query
.
deathcancel
==
"all"
or
u
.
query
.
deathcancel
==
room
.
process
.
pid
.
toString
())
for
room
in
ROOM_all
when
room
and
room
.
established
and
room
.
started
and
room
.
death
and
(
u
.
query
.
deathcancel
==
"all"
or
u
.
query
.
deathcancel
==
room
.
process
_
pid
.
toString
())
death_room_found
=
true
death_room_found
=
true
room
.
death
=
0
room
.
death
=
0
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death_cancel}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
ygopro
.
stoc_send_chat_to_room
(
room
,
"${death_cancel}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
...
...
ygopro-server.js
View file @
306c62e1
...
@@ -1237,6 +1237,7 @@
...
@@ -1237,6 +1237,7 @@
this
.
process
=
spawn
(
'
./ygopro
'
,
param
,
{
this
.
process
=
spawn
(
'
./ygopro
'
,
param
,
{
cwd
:
'
ygopro
'
cwd
:
'
ygopro
'
});
});
this
.
process_pid
=
this
.
process
.
pid
;
this
.
process
.
on
(
'
error
'
,
(
function
(
_this
)
{
this
.
process
.
on
(
'
error
'
,
(
function
(
_this
)
{
return
function
(
err
)
{
return
function
(
err
)
{
_
.
each
(
_this
.
players
,
function
(
player
)
{
_
.
each
(
_this
.
players
,
function
(
player
)
{
...
@@ -3128,7 +3129,7 @@
...
@@ -3128,7 +3129,7 @@
deck_arena
=
deck_arena
+
'
custom
'
;
deck_arena
=
deck_arena
+
'
custom
'
;
}
}
if
(
settings
.
modules
.
deck_log
.
local
)
{
if
(
settings
.
modules
.
deck_log
.
local
)
{
deck_name
=
moment
().
format
(
'
YYYY-MM-DD HH-mm-ss
'
)
+
'
'
+
room
.
process
.
pid
+
'
'
+
client
.
pos
+
'
'
+
client
.
ip
.
slice
(
7
)
+
'
'
+
client
.
name
.
replace
(
/
[\/\\\?\*]
/g
,
'
_
'
);
deck_name
=
moment
().
format
(
'
YYYY-MM-DD HH-mm-ss
'
)
+
'
'
+
room
.
process
_
pid
+
'
'
+
client
.
pos
+
'
'
+
client
.
ip
.
slice
(
7
)
+
'
'
+
client
.
name
.
replace
(
/
[\/\\\?\*]
/g
,
'
_
'
);
fs
.
writeFile
(
settings
.
modules
.
deck_log
.
local
+
deck_name
+
'
.ydk
'
,
deck_text
,
'
utf-8
'
,
function
(
err
)
{
fs
.
writeFile
(
settings
.
modules
.
deck_log
.
local
+
deck_name
+
'
.ydk
'
,
deck_text
,
'
utf-8
'
,
function
(
err
)
{
if
(
err
)
{
if
(
err
)
{
return
log
.
warn
(
'
DECK SAVE ERROR
'
,
err
);
return
log
.
warn
(
'
DECK SAVE ERROR
'
,
err
);
...
@@ -3803,7 +3804,7 @@
...
@@ -3803,7 +3804,7 @@
duellog
=
{
duellog
=
{
time
:
dueltime
,
time
:
dueltime
,
name
:
room
.
name
+
(
settings
.
modules
.
tournament_mode
.
show_info
?
"
(Duel:
"
+
room
.
duel_count
+
"
)
"
:
""
),
name
:
room
.
name
+
(
settings
.
modules
.
tournament_mode
.
show_info
?
"
(Duel:
"
+
room
.
duel_count
+
"
)
"
:
""
),
roomid
:
room
.
process
.
pid
.
toString
(),
roomid
:
room
.
process
_
pid
.
toString
(),
cloud_replay_id
:
"
R#
"
+
room
.
cloud_replay_id
,
cloud_replay_id
:
"
R#
"
+
room
.
cloud_replay_id
,
replay_filename
:
replay_filename
,
replay_filename
:
replay_filename
,
roommode
:
room
.
hostinfo
.
mode
,
roommode
:
room
.
hostinfo
.
mode
,
...
@@ -3970,7 +3971,7 @@
...
@@ -3970,7 +3971,7 @@
room
=
ROOM_all
[
m
];
room
=
ROOM_all
[
m
];
if
(
room
&&
room
.
established
)
{
if
(
room
&&
room
.
established
)
{
results
.
push
({
results
.
push
({
roomid
:
room
.
process
.
pid
.
toString
(),
roomid
:
room
.
process
_
pid
.
toString
(),
roomname
:
pass_validated
?
room
.
name
:
room
.
name
.
split
(
'
$
'
,
2
)[
0
],
roomname
:
pass_validated
?
room
.
name
:
room
.
name
.
split
(
'
$
'
,
2
)[
0
],
roommode
:
room
.
hostinfo
.
mode
,
roommode
:
room
.
hostinfo
.
mode
,
needpass
:
(
room
.
name
.
indexOf
(
'
$
'
)
!==
-
1
).
toString
(),
needpass
:
(
room
.
name
.
indexOf
(
'
$
'
)
!==
-
1
).
toString
(),
...
@@ -4163,7 +4164,7 @@
...
@@ -4163,7 +4164,7 @@
kick_room_found
=
false
;
kick_room_found
=
false
;
for
(
o
=
0
,
len4
=
ROOM_all
.
length
;
o
<
len4
;
o
++
)
{
for
(
o
=
0
,
len4
=
ROOM_all
.
length
;
o
<
len4
;
o
++
)
{
room
=
ROOM_all
[
o
];
room
=
ROOM_all
[
o
];
if
(
!
(
room
&&
room
.
established
&&
(
u
.
query
.
kick
===
"
all
"
||
u
.
query
.
kick
===
room
.
process
.
pid
.
toString
()
||
u
.
query
.
kick
===
room
.
name
)))
{
if
(
!
(
room
&&
room
.
established
&&
(
u
.
query
.
kick
===
"
all
"
||
u
.
query
.
kick
===
room
.
process
_
pid
.
toString
()
||
u
.
query
.
kick
===
room
.
name
)))
{
continue
;
continue
;
}
}
kick_room_found
=
true
;
kick_room_found
=
true
;
...
@@ -4185,7 +4186,7 @@
...
@@ -4185,7 +4186,7 @@
death_room_found
=
false
;
death_room_found
=
false
;
for
(
p
=
0
,
len5
=
ROOM_all
.
length
;
p
<
len5
;
p
++
)
{
for
(
p
=
0
,
len5
=
ROOM_all
.
length
;
p
<
len5
;
p
++
)
{
room
=
ROOM_all
[
p
];
room
=
ROOM_all
[
p
];
if
(
!
(
room
&&
room
.
established
&&
room
.
started
&&
!
room
.
death
&&
(
u
.
query
.
death
===
"
all
"
||
u
.
query
.
death
===
room
.
process
.
pid
.
toString
()
||
u
.
query
.
death
===
room
.
name
)))
{
if
(
!
(
room
&&
room
.
established
&&
room
.
started
&&
!
room
.
death
&&
(
u
.
query
.
death
===
"
all
"
||
u
.
query
.
death
===
room
.
process
_
pid
.
toString
()
||
u
.
query
.
death
===
room
.
name
)))
{
continue
;
continue
;
}
}
death_room_found
=
true
;
death_room_found
=
true
;
...
@@ -4247,7 +4248,7 @@
...
@@ -4247,7 +4248,7 @@
death_room_found
=
false
;
death_room_found
=
false
;
for
(
q
=
0
,
len6
=
ROOM_all
.
length
;
q
<
len6
;
q
++
)
{
for
(
q
=
0
,
len6
=
ROOM_all
.
length
;
q
<
len6
;
q
++
)
{
room
=
ROOM_all
[
q
];
room
=
ROOM_all
[
q
];
if
(
!
(
room
&&
room
.
established
&&
room
.
started
&&
room
.
death
&&
(
u
.
query
.
deathcancel
===
"
all
"
||
u
.
query
.
deathcancel
===
room
.
process
.
pid
.
toString
())))
{
if
(
!
(
room
&&
room
.
established
&&
room
.
started
&&
room
.
death
&&
(
u
.
query
.
deathcancel
===
"
all
"
||
u
.
query
.
deathcancel
===
room
.
process
_
pid
.
toString
())))
{
continue
;
continue
;
}
}
death_room_found
=
true
;
death_room_found
=
true
;
...
...
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