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
553b983a
Commit
553b983a
authored
Aug 30, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
catchup
parent
ba709cfd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
13 deletions
+13
-13
struct.js
struct.js
+1
-1
ygopro-server.coffee
ygopro-server.coffee
+6
-6
ygopro-server.js
ygopro-server.js
+4
-4
ygopro.coffee
ygopro.coffee
+2
-2
No files found.
struct.js
View file @
553b983a
...
@@ -251,7 +251,7 @@ function Struct() {
...
@@ -251,7 +251,7 @@ function Struct() {
this
.
allocate
=
function
()
{
this
.
allocate
=
function
()
{
applyClosures
(
priv
);
applyClosures
(
priv
);
priv
.
buf
=
new
Buffer
(
priv
.
len
);
priv
.
buf
=
Buffer
.
alloc
(
priv
.
len
);
allocateFields
();
allocateFields
();
priv
.
allocated
=
true
;
priv
.
allocated
=
true
;
return
this
;
return
this
;
...
...
ygopro-server.coffee
View file @
553b983a
...
@@ -1183,7 +1183,7 @@ net.createServer (client) ->
...
@@ -1183,7 +1183,7 @@ net.createServer (client) ->
ygopro
.
stoc_die
(
client
,
"${cloud_replay_no}"
)
ygopro
.
stoc_die
(
client
,
"${cloud_replay_no}"
)
return
return
redisdb
.
expire
(
"replay:"
+
replay
.
replay_id
,
60
*
60
*
48
)
redisdb
.
expire
(
"replay:"
+
replay
.
replay_id
,
60
*
60
*
48
)
buffer
=
new
Buffer
(
replay
.
replay_buffer
,
'binary'
)
buffer
=
Buffer
.
from
(
replay
.
replay_buffer
,
'binary'
)
zlib
.
unzip
buffer
,
(
err
,
replay_buffer
)
->
zlib
.
unzip
buffer
,
(
err
,
replay_buffer
)
->
if
err
if
err
log
.
info
"cloud replay unzip error: "
+
err
log
.
info
"cloud replay unzip error: "
+
err
...
@@ -1207,7 +1207,7 @@ net.createServer (client) ->
...
@@ -1207,7 +1207,7 @@ net.createServer (client) ->
room
=
ROOM_all
[
client
.
rid
]
room
=
ROOM_all
[
client
.
rid
]
room
.
watcher
.
write
ctos_buffer
if
room
room
.
watcher
.
write
ctos_buffer
if
room
else
else
#ctos_buffer =
new Buffer
(0)
#ctos_buffer =
Buffer.alloc
(0)
ctos_message_length
=
0
ctos_message_length
=
0
ctos_proto
=
0
ctos_proto
=
0
#ctos_buffer = Buffer.concat([ctos_buffer, data], ctos_buffer.length + data.length) #buffer的错误使用方式,好孩子不要学
#ctos_buffer = Buffer.concat([ctos_buffer, data], ctos_buffer.length + data.length) #buffer的错误使用方式,好孩子不要学
...
@@ -1275,7 +1275,7 @@ net.createServer (client) ->
...
@@ -1275,7 +1275,7 @@ net.createServer (client) ->
# 服务端到客户端(stoc)
# 服务端到客户端(stoc)
server
.
on
'data'
,
(
stoc_buffer
)
->
server
.
on
'data'
,
(
stoc_buffer
)
->
#stoc_buffer =
new Buffer
(0)
#stoc_buffer =
Buffer.alloc
(0)
stoc_message_length
=
0
stoc_message_length
=
0
stoc_proto
=
0
stoc_proto
=
0
#stoc_buffer = Buffer.concat([stoc_buffer, data], stoc_buffer.length + data.length) #buffer的错误使用方式,好孩子不要学
#stoc_buffer = Buffer.concat([stoc_buffer, data], stoc_buffer.length + data.length) #buffer的错误使用方式,好孩子不要学
...
@@ -1453,7 +1453,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
...
@@ -1453,7 +1453,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
# struct.set("version", info.version)
# struct.set("version", info.version)
# buffer = struct.buffer
# buffer = struct.buffer
buffer
=
new
Buffer
(
info
.
pass
[
0
...
8
],
'base64'
)
buffer
=
Buffer
.
from
(
info
.
pass
[
0
...
8
],
'base64'
)
if
buffer
.
length
!=
6
if
buffer
.
length
!=
6
ygopro
.
stoc_die
(
client
,
'${invalid_password_payload}'
)
ygopro
.
stoc_die
(
client
,
'${invalid_password_payload}'
)
...
@@ -1556,7 +1556,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
...
@@ -1556,7 +1556,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
if
id
=
users_cache
[
client
.
name
]
if
id
=
users_cache
[
client
.
name
]
secret
=
id
%
65535
+
1
secret
=
id
%
65535
+
1
decrypted_buffer
=
new
Buffer
(
6
)
decrypted_buffer
=
Buffer
.
allocUnsafe
(
6
)
for
i
in
[
0
,
2
,
4
]
for
i
in
[
0
,
2
,
4
]
decrypted_buffer
.
writeUInt16LE
(
buffer
.
readUInt16LE
(
i
)
^
secret
,
i
)
decrypted_buffer
.
writeUInt16LE
(
buffer
.
readUInt16LE
(
i
)
^
secret
,
i
)
if
check
(
decrypted_buffer
)
if
check
(
decrypted_buffer
)
...
@@ -1575,7 +1575,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
...
@@ -1575,7 +1575,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
if
body
and
body
.
user
if
body
and
body
.
user
users_cache
[
client
.
name
]
=
body
.
user
.
id
users_cache
[
client
.
name
]
=
body
.
user
.
id
secret
=
body
.
user
.
id
%
65535
+
1
secret
=
body
.
user
.
id
%
65535
+
1
decrypted_buffer
=
new
Buffer
(
6
)
decrypted_buffer
=
Buffer
.
allocUnsafe
(
6
)
for
i
in
[
0
,
2
,
4
]
for
i
in
[
0
,
2
,
4
]
decrypted_buffer
.
writeUInt16LE
(
buffer
.
readUInt16LE
(
i
)
^
secret
,
i
)
decrypted_buffer
.
writeUInt16LE
(
buffer
.
readUInt16LE
(
i
)
^
secret
,
i
)
if
check
(
decrypted_buffer
)
if
check
(
decrypted_buffer
)
...
...
ygopro-server.js
View file @
553b983a
...
@@ -1520,7 +1520,7 @@
...
@@ -1520,7 +1520,7 @@
return
;
return
;
}
}
redisdb
.
expire
(
"
replay:
"
+
replay
.
replay_id
,
60
*
60
*
48
);
redisdb
.
expire
(
"
replay:
"
+
replay
.
replay_id
,
60
*
60
*
48
);
buffer
=
new
Buffer
(
replay
.
replay_buffer
,
'
binary
'
);
buffer
=
Buffer
.
from
(
replay
.
replay_buffer
,
'
binary
'
);
zlib
.
unzip
(
buffer
,
function
(
err
,
replay_buffer
)
{
zlib
.
unzip
(
buffer
,
function
(
err
,
replay_buffer
)
{
if
(
err
)
{
if
(
err
)
{
log
.
info
(
"
cloud replay unzip error:
"
+
err
);
log
.
info
(
"
cloud replay unzip error:
"
+
err
);
...
@@ -1806,7 +1806,7 @@
...
@@ -1806,7 +1806,7 @@
ygopro
.
stoc_die
(
client
,
'
${invalid_password_length}
'
);
ygopro
.
stoc_die
(
client
,
'
${invalid_password_length}
'
);
return
;
return
;
}
}
buffer
=
new
Buffer
(
info
.
pass
.
slice
(
0
,
8
),
'
base64
'
);
buffer
=
Buffer
.
from
(
info
.
pass
.
slice
(
0
,
8
),
'
base64
'
);
if
(
buffer
.
length
!==
6
)
{
if
(
buffer
.
length
!==
6
)
{
ygopro
.
stoc_die
(
client
,
'
${invalid_password_payload}
'
);
ygopro
.
stoc_die
(
client
,
'
${invalid_password_payload}
'
);
return
;
return
;
...
@@ -1922,7 +1922,7 @@
...
@@ -1922,7 +1922,7 @@
};
};
if
(
id
=
users_cache
[
client
.
name
])
{
if
(
id
=
users_cache
[
client
.
name
])
{
secret
=
id
%
65535
+
1
;
secret
=
id
%
65535
+
1
;
decrypted_buffer
=
new
Buffer
(
6
);
decrypted_buffer
=
Buffer
.
allocUnsafe
(
6
);
ref2
=
[
0
,
2
,
4
];
ref2
=
[
0
,
2
,
4
];
for
(
m
=
0
,
len2
=
ref2
.
length
;
m
<
len2
;
m
++
)
{
for
(
m
=
0
,
len2
=
ref2
.
length
;
m
<
len2
;
m
++
)
{
i
=
ref2
[
m
];
i
=
ref2
[
m
];
...
@@ -1946,7 +1946,7 @@
...
@@ -1946,7 +1946,7 @@
if
(
body
&&
body
.
user
)
{
if
(
body
&&
body
.
user
)
{
users_cache
[
client
.
name
]
=
body
.
user
.
id
;
users_cache
[
client
.
name
]
=
body
.
user
.
id
;
secret
=
body
.
user
.
id
%
65535
+
1
;
secret
=
body
.
user
.
id
%
65535
+
1
;
decrypted_buffer
=
new
Buffer
(
6
);
decrypted_buffer
=
Buffer
.
allocUnsafe
(
6
);
ref3
=
[
0
,
2
,
4
];
ref3
=
[
0
,
2
,
4
];
for
(
n
=
0
,
len3
=
ref3
.
length
;
n
<
len3
;
n
++
)
{
for
(
n
=
0
,
len3
=
ref3
.
length
;
n
<
len3
;
n
++
)
{
i
=
ref3
[
n
];
i
=
ref3
[
n
];
...
...
ygopro.coffee
View file @
553b983a
...
@@ -80,7 +80,7 @@ for name, declaration of structs_declaration
...
@@ -80,7 +80,7 @@ for name, declaration of structs_declaration
break
break
throw
"unknown proto"
if
!
@
constants
.
STOC
[
proto
]
throw
"unknown proto"
if
!
@
constants
.
STOC
[
proto
]
header
=
new
Buffer
(
3
)
header
=
Buffer
.
allocUnsafe
(
3
)
header
.
writeUInt16LE
buffer
.
length
+
1
,
0
header
.
writeUInt16LE
buffer
.
length
+
1
,
0
header
.
writeUInt8
proto
,
2
header
.
writeUInt8
proto
,
2
socket
.
write
header
socket
.
write
header
...
@@ -108,7 +108,7 @@ for name, declaration of structs_declaration
...
@@ -108,7 +108,7 @@ for name, declaration of structs_declaration
break
break
throw
"unknown proto"
if
!
@
constants
.
CTOS
[
proto
]
throw
"unknown proto"
if
!
@
constants
.
CTOS
[
proto
]
header
=
new
Buffer
(
3
)
header
=
Buffer
.
allocUnsafe
(
3
)
header
.
writeUInt16LE
buffer
.
length
+
1
,
0
header
.
writeUInt16LE
buffer
.
length
+
1
,
0
header
.
writeUInt8
proto
,
2
header
.
writeUInt8
proto
,
2
socket
.
write
header
socket
.
write
header
...
...
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