Commit e1fa6f57 authored by 神楽坂玲奈's avatar 神楽坂玲奈

fix

parent 6cfdb64d
Pipeline #16054 failed with stages
in 1 minute and 6 seconds
......@@ -7,11 +7,11 @@ import { api } from './Api';
import express from 'express';
import path from 'path';
// http
const app = express();
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', api);
app.listen(config.port);
// udp routing protocol
const socket = dgram
......@@ -20,17 +20,16 @@ const socket = dgram
const address = socket.address();
console.log(`listening ${address.address}:${address.port}`);
})
.on('message', function(message, rinfo) {
.on('message', function (message, rinfo) {
try {
const hello: UploadMessage = JSON.parse(message.toString());
assert(hello.id);
const router: Router = Router.all.find(r => r.id === hello.id)!;
const router: Router = Router.all.find((r) => r.id === hello.id)!;
assert(router);
router.rinfo = rinfo;
router.onMessage(hello);
} catch (e) {
console.warn(e);
}
......
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