Commit 5332a0e1 authored by 神楽坂玲奈's avatar 神楽坂玲奈

dns resolve by server

parent 2f440016
......@@ -223,7 +223,7 @@ let pair = function (userARes, userBRes, serverName) {
playingPlayerPool.set(client.username, result);
playingPlayerTimeout.set(client.username, setTimeout(timeoutUser, config.match.longestMatchTime, client.username));
client.writeHead(200, {'Content-Type': 'application/json', 'Cache-Control': 'no-cache'});
resolve(result).then(r =>
lookup(result).then(r =>
client.end(JSON.stringify(r))
);
}
......@@ -347,7 +347,7 @@ let matchResponse = function(req, res) {
res.writeHead(200, {'Content-Type': 'application/json', 'Cache-Control': 'no-cache'});
let message = playingPlayerPool.get(username);
localLog(username + " is relining to: " + message);
resolve(username).then(r =>
lookup(message).then(r =>
res.end(JSON.stringify(r))
);
return;
......@@ -478,7 +478,7 @@ let textResponse = function (res, text) {
res.end(text);
};
function resolve(result) {
function lookup(result) {
return new Promise((resolve, reject) => {
dns.lookup(result.address, {family :4},(err, address, family) => {
if (err) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment