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
0f5c4d51
Commit
0f5c4d51
authored
Jun 18, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
01274c16
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
27 deletions
+57
-27
ygopro-server.coffee
ygopro-server.coffee
+21
-11
ygopro-server.js
ygopro-server.js
+36
-16
No files found.
ygopro-server.coffee
View file @
0f5c4d51
...
...
@@ -425,10 +425,12 @@ CLIENT_get_authorize_key = (client) ->
else
return
client
.
ip
CLIENT_reconnect_unregister
=
(
client
,
reconnected
)
->
CLIENT_reconnect_unregister
=
(
client
,
reconnected
,
exact
)
->
if
!
settings
.
modules
.
reconnect
.
enabled
return
false
if
disconnect_list
[
CLIENT_get_authorize_key
(
client
)]
if
exact
and
disconnect_list
[
CLIENT_get_authorize_key
(
client
)].
old_client
!=
client
return
false
release_disconnect
(
disconnect_list
[
CLIENT_get_authorize_key
(
client
)],
reconnected
)
delete
disconnect_list
[
CLIENT_get_authorize_key
(
client
)]
return
true
...
...
@@ -438,8 +440,11 @@ CLIENT_reconnect_register = (client, room_id, error) ->
room
=
ROOM_all
[
room_id
]
if
client
.
had_new_reconnection
return
false
if
!
settings
.
modules
.
reconnect
.
enabled
or
client
.
system_kicked
or
disconnect_list
[
CLIENT_get_authorize_key
(
client
)]
or
client
.
is_post_watcher
or
!
CLIENT_is_player
(
client
,
room
)
or
!
room
.
started
or
(
room
.
windbot
and
client
.
is_local
)
or
(
settings
.
modules
.
reconnect
.
auto_surrender_after_disconnect
and
room
.
hostinfo
.
mode
!=
1
)
if
!
settings
.
modules
.
reconnect
.
enabled
or
!
room
or
client
.
system_kicked
or
disconnect_list
[
CLIENT_get_authorize_key
(
client
)]
or
client
.
is_post_watcher
or
!
CLIENT_is_player
(
client
,
room
)
or
!
room
.
started
or
(
room
.
windbot
and
client
.
is_local
)
or
(
settings
.
modules
.
reconnect
.
auto_surrender_after_disconnect
and
room
.
hostinfo
.
mode
!=
1
)
return
false
for
player
in
room
.
players
if
player
!=
client
and
CLIENT_get_authorize_key
(
player
)
==
CLIENT_get_authorize_key
(
client
)
return
false
# some issues may occur in this case, so return false
dinfo
=
{
room_id
:
room_id
,
old_client
:
client
,
...
...
@@ -497,13 +502,22 @@ CLIENT_import_data = (client, old_client, room) ->
return
SERVER_clear_disconnect
=
(
server
)
->
return
unless
settings
.
modules
.
reconnect
.
enabled
return
false
unless
settings
.
modules
.
reconnect
.
enabled
for
k
,
v
of
disconnect_list
if
v
and
server
==
v
.
old_server
release_disconnect
(
v
)
delete
disconnect_list
[
k
]
return
return
return
true
return
false
ROOM_clear_disconnect
=
(
room_id
)
->
return
false
unless
settings
.
modules
.
reconnect
.
enabled
for
k
,
v
of
disconnect_list
if
v
and
room_id
==
v
.
room_id
release_disconnect
(
v
)
delete
disconnect_list
[
k
]
return
true
return
false
CLIENT_is_player
=
(
client
,
room
)
->
is_player
=
false
...
...
@@ -836,11 +850,7 @@ class Room
@
deleted
=
true
index
=
_
.
indexOf
(
ROOM_all
,
this
)
if
settings
.
modules
.
reconnect
.
enabled
for
k
,
v
of
disconnect_list
if
v
and
index
==
v
.
room_id
release_disconnect
(
v
)
delete
disconnect_list
[
k
]
break
ROOM_clear_disconnect
(
index
)
ROOM_all
[
index
]
=
null
unless
index
==
-
1
#ROOM_all.splice(index, 1) unless index == -1
roomlist
.
delete
this
if
!
@
windbot
and
@
established
and
settings
.
modules
.
http
.
websocket_roomlist
...
...
@@ -925,7 +935,7 @@ class Room
@
process
.
kill
()
#client.room = null
this
.
delete
()
if
!
CLIENT_reconnect_unregister
(
client
)
if
!
CLIENT_reconnect_unregister
(
client
,
false
,
true
)
client
.
server
.
destroy
()
return
...
...
ygopro-server.js
View file @
0f5c4d51
// Generated by CoffeeScript 1.12.7
(
function
()
{
var
CLIENT_get_authorize_key
,
CLIENT_import_data
,
CLIENT_is_able_to_reconnect
,
CLIENT_is_player
,
CLIENT_kick
,
CLIENT_pre_reconnect
,
CLIENT_reconnect
,
CLIENT_reconnect_register
,
CLIENT_reconnect_unregister
,
CLIENT_send_pre_reconnect_info
,
CLIENT_send_reconnect_info
,
Cloud_replay_ids
,
ROOM_all
,
ROOM_bad_ip
,
ROOM_ban_player
,
ROOM_connected_ip
,
ROOM_find_by_name
,
ROOM_find_by_port
,
ROOM_find_by_title
,
ROOM_find_or_create_ai
,
ROOM_find_or_create_by_name
,
ROOM_find_or_create_random
,
ROOM_players_banned
,
ROOM_players_oppentlist
,
ROOM_unwelcome
,
ROOM_validate
,
Room
,
SERVER_clear_disconnect
,
_
,
addCallback
,
badwords
,
ban_user
,
bunyan
,
chat_color
,
config
,
cppversion
,
crypto
,
date
,
default_config
,
default_data
,
dialogues
,
disconnect_list
,
duel_log
,
e
,
exec
,
execFile
,
fs
,
geoip
,
get_memory_usage
,
http
,
http_server
,
https
,
https_server
,
j
,
l
,
len
,
len1
,
lflists
,
list
,
loadJSON
,
load_dialogues
,
load_tips
,
log
,
memory_usage
,
merge
,
moment
,
net
,
oldbadwords
,
oldconfig
,
olddialogues
,
oldduellog
,
oldtips
,
options
,
os
,
path
,
pgClient
,
pg_client
,
pg_query
,
redis
,
redisdb
,
ref
,
ref1
,
release_disconnect
,
report_to_big_brother
,
request
,
requestListener
,
roomlist
,
setting_change
,
setting_save
,
settings
,
spawn
,
spawnSync
,
tips
,
url
,
users_cache
,
wait_room_start
,
wait_room_start_arena
,
windbot_bin
,
windbot_parameters
,
windbot_process
,
windbots
,
ygopro
,
zlib
;
var
CLIENT_get_authorize_key
,
CLIENT_import_data
,
CLIENT_is_able_to_reconnect
,
CLIENT_is_player
,
CLIENT_kick
,
CLIENT_pre_reconnect
,
CLIENT_reconnect
,
CLIENT_reconnect_register
,
CLIENT_reconnect_unregister
,
CLIENT_send_pre_reconnect_info
,
CLIENT_send_reconnect_info
,
Cloud_replay_ids
,
ROOM_all
,
ROOM_bad_ip
,
ROOM_ban_player
,
ROOM_c
lear_disconnect
,
ROOM_c
onnected_ip
,
ROOM_find_by_name
,
ROOM_find_by_port
,
ROOM_find_by_title
,
ROOM_find_or_create_ai
,
ROOM_find_or_create_by_name
,
ROOM_find_or_create_random
,
ROOM_players_banned
,
ROOM_players_oppentlist
,
ROOM_unwelcome
,
ROOM_validate
,
Room
,
SERVER_clear_disconnect
,
_
,
addCallback
,
badwords
,
ban_user
,
bunyan
,
chat_color
,
config
,
cppversion
,
crypto
,
date
,
default_config
,
default_data
,
dialogues
,
disconnect_list
,
duel_log
,
e
,
exec
,
execFile
,
fs
,
geoip
,
get_memory_usage
,
http
,
http_server
,
https
,
https_server
,
j
,
l
,
len
,
len1
,
lflists
,
list
,
loadJSON
,
load_dialogues
,
load_tips
,
log
,
memory_usage
,
merge
,
moment
,
net
,
oldbadwords
,
oldconfig
,
olddialogues
,
oldduellog
,
oldtips
,
options
,
os
,
path
,
pgClient
,
pg_client
,
pg_query
,
redis
,
redisdb
,
ref
,
ref1
,
release_disconnect
,
report_to_big_brother
,
request
,
requestListener
,
roomlist
,
setting_change
,
setting_save
,
settings
,
spawn
,
spawnSync
,
tips
,
url
,
users_cache
,
wait_room_start
,
wait_room_start_arena
,
windbot_bin
,
windbot_parameters
,
windbot_process
,
windbots
,
ygopro
,
zlib
;
net
=
require
(
'
net
'
);
...
...
@@ -585,11 +585,14 @@
}
};
CLIENT_reconnect_unregister
=
function
(
client
,
reconnected
)
{
CLIENT_reconnect_unregister
=
function
(
client
,
reconnected
,
exact
)
{
if
(
!
settings
.
modules
.
reconnect
.
enabled
)
{
return
false
;
}
if
(
disconnect_list
[
CLIENT_get_authorize_key
(
client
)])
{
if
(
exact
&&
disconnect_list
[
CLIENT_get_authorize_key
(
client
)].
old_client
!==
client
)
{
return
false
;
}
release_disconnect
(
disconnect_list
[
CLIENT_get_authorize_key
(
client
)],
reconnected
);
delete
disconnect_list
[
CLIENT_get_authorize_key
(
client
)];
return
true
;
...
...
@@ -598,14 +601,21 @@
};
CLIENT_reconnect_register
=
function
(
client
,
room_id
,
error
)
{
var
dinfo
,
room
,
tmot
;
var
dinfo
,
len2
,
m
,
player
,
ref2
,
room
,
tmot
;
room
=
ROOM_all
[
room_id
];
if
(
client
.
had_new_reconnection
)
{
return
false
;
}
if
(
!
settings
.
modules
.
reconnect
.
enabled
||
client
.
system_kicked
||
disconnect_list
[
CLIENT_get_authorize_key
(
client
)]
||
client
.
is_post_watcher
||
!
CLIENT_is_player
(
client
,
room
)
||
!
room
.
started
||
(
room
.
windbot
&&
client
.
is_local
)
||
(
settings
.
modules
.
reconnect
.
auto_surrender_after_disconnect
&&
room
.
hostinfo
.
mode
!==
1
))
{
if
(
!
settings
.
modules
.
reconnect
.
enabled
||
!
room
||
client
.
system_kicked
||
disconnect_list
[
CLIENT_get_authorize_key
(
client
)]
||
client
.
is_post_watcher
||
!
CLIENT_is_player
(
client
,
room
)
||
!
room
.
started
||
(
room
.
windbot
&&
client
.
is_local
)
||
(
settings
.
modules
.
reconnect
.
auto_surrender_after_disconnect
&&
room
.
hostinfo
.
mode
!==
1
))
{
return
false
;
}
ref2
=
room
.
players
;
for
(
m
=
0
,
len2
=
ref2
.
length
;
m
<
len2
;
m
++
)
{
player
=
ref2
[
m
];
if
(
player
!==
client
&&
CLIENT_get_authorize_key
(
player
)
===
CLIENT_get_authorize_key
(
client
))
{
return
false
;
}
}
dinfo
=
{
room_id
:
room_id
,
old_client
:
client
,
...
...
@@ -672,16 +682,33 @@
SERVER_clear_disconnect
=
function
(
server
)
{
var
k
,
v
;
if
(
!
settings
.
modules
.
reconnect
.
enabled
)
{
return
;
return
false
;
}
for
(
k
in
disconnect_list
)
{
v
=
disconnect_list
[
k
];
if
(
v
&&
server
===
v
.
old_server
)
{
release_disconnect
(
v
);
delete
disconnect_list
[
k
];
return
;
return
true
;
}
}
return
false
;
};
ROOM_clear_disconnect
=
function
(
room_id
)
{
var
k
,
v
;
if
(
!
settings
.
modules
.
reconnect
.
enabled
)
{
return
false
;
}
for
(
k
in
disconnect_list
)
{
v
=
disconnect_list
[
k
];
if
(
v
&&
room_id
===
v
.
room_id
)
{
release_disconnect
(
v
);
delete
disconnect_list
[
k
];
return
true
;
}
}
return
false
;
};
CLIENT_is_player
=
function
(
client
,
room
)
{
...
...
@@ -1009,7 +1036,7 @@
}
Room
.
prototype
[
"
delete
"
]
=
function
()
{
var
end_time
,
index
,
k
,
log_rep_id
,
name
,
player_ips
,
player_names
,
recorder_buffer
,
ref2
,
replay_id
,
score
,
score_array
,
v
;
var
end_time
,
index
,
log_rep_id
,
name
,
player_ips
,
player_names
,
recorder_buffer
,
ref2
,
replay_id
,
score
,
score_array
;
if
(
this
.
deleted
)
{
return
;
}
...
...
@@ -1097,14 +1124,7 @@
this
.
deleted
=
true
;
index
=
_
.
indexOf
(
ROOM_all
,
this
);
if
(
settings
.
modules
.
reconnect
.
enabled
)
{
for
(
k
in
disconnect_list
)
{
v
=
disconnect_list
[
k
];
if
(
v
&&
index
===
v
.
room_id
)
{
release_disconnect
(
v
);
delete
disconnect_list
[
k
];
break
;
}
}
ROOM_clear_disconnect
(
index
);
}
if
(
index
!==
-
1
)
{
ROOM_all
[
index
]
=
null
;
...
...
@@ -1223,7 +1243,7 @@
this
.
process
.
kill
();
this
[
"
delete
"
]();
}
if
(
!
CLIENT_reconnect_unregister
(
client
))
{
if
(
!
CLIENT_reconnect_unregister
(
client
,
false
,
true
))
{
client
.
server
.
destroy
();
}
}
...
...
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