Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-match
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
MyCard
ygopro-match
Commits
709ef083
Commit
709ef083
authored
Feb 25, 2013
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parents
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
0 deletions
+77
-0
.gitattributes
.gitattributes
+22
-0
.gitignore
.gitignore
+11
-0
config.js
config.js
+7
-0
mycard-server-match.coffee
mycard-server-match.coffee
+37
-0
No files found.
.gitattributes
0 → 100644
View file @
709ef083
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
.gitignore
0 → 100644
View file @
709ef083
#################
## Jetbrains
#################
/.idea/
#################
## Node
#################
/node_modules/
\ No newline at end of file
config.js
0 → 100644
View file @
709ef083
module
.
exports
=
{
port
:
9997
,
servers
:
[
{
ip
:
'
122.0.65.70
'
,
port
:
7977
}
]
}
\ No newline at end of file
mycard-server-match.coffee
0 → 100644
View file @
709ef083
http
=
require
(
"http"
)
url
=
require
(
"url"
)
_
=
require
(
"underscore"
)
settings
=
require
(
"./config"
)
room_index
=
0
waiting
=
[]
server
=
http
.
createServer
(
request
,
response
)
->
console
.
log
"
#{
new
Date
()
}
Received request for
#{
request
.
url
}
from
#{
request
.
connection
.
remoteAddress
}
)"
if
url
.
parse
(
request
.
url
).
pathname
!=
'/match.json'
response
.
writeHead
(
404
);
response
.
end
();
return
response
.
writeHead
(
200
,
{
"Content-Type"
:
"application/json"
})
if
waiting
.
length
==
0
waiting
.
push
response
request
.
connection
.
addListener
'close'
,
->
index
=
waiting
.
indexOf
(
response
);
if
index
!=
-
1
waiting
.
splice
(
response
,
1
);
console
.
log
"
#{
new
Date
()
}
Peer
#{
request
.
connection
.
remoteAddress
}
disconnected during waiting."
response
.
connection
.
setTimeout
(
0
)
else
s
=
settings
.
servers
[
0
]
room
=
"mycard://
#{
s
.
ip
}
:
#{
s
.
port
}
/
#{
room_index
}
$
#{
Math
.
floor
(
Math
.
random
()
*
1000
)
}
"
#new Buffer("Hello World").toString('base64'));
console
.
log
"matched:
#{
room
}
"
opponent_response
=
waiting
.
pop
()
opponent_response
.
end
room
response
.
end
room
room_index
=
room_index
+
1
%
100000
.
listen
(
settings
.
port
)
\ No newline at end of file
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