Commit 875e507166259a02838907943e5dd383e4dd7d16
1 parent
df883a11
服务名称修改
Showing
9 changed files
with
24 additions
and
19 deletions
Show diff stats
src/services/agent_ctrl.lua
| @@ -128,7 +128,7 @@ function _M:check_agent_status() | @@ -128,7 +128,7 @@ function _M:check_agent_status() | ||
| 128 | next_log_time = now + 60 | 128 | next_log_time = now + 60 |
| 129 | local count = table_nums(self.u2f) | 129 | local count = table_nums(self.u2f) |
| 130 | datacenter.set("onlineCount", count) | 130 | datacenter.set("onlineCount", count) |
| 131 | - pcall(skynet.send, logd, "lua", "log", "online", {count = count}) | 131 | + pcall(skynet.send, logd, "lua", "log", "online", {count = count}, "online") |
| 132 | end | 132 | end |
| 133 | end | 133 | end |
| 134 | 134 |
src/services/chated.lua
| @@ -35,7 +35,7 @@ if mode == "sub" then | @@ -35,7 +35,7 @@ if mode == "sub" then | ||
| 35 | skynet.ret(skynet.pack(f(...))) | 35 | skynet.ret(skynet.pack(f(...))) |
| 36 | end) | 36 | end) |
| 37 | 37 | ||
| 38 | - skynet.register(string.format("CHATED%d", id)) | 38 | + skynet.register(string.format(".CHATED%d", id)) |
| 39 | end) | 39 | end) |
| 40 | else | 40 | else |
| 41 | skynet.start(function() | 41 | skynet.start(function() |
src/services/csvdatad.lua
src/services/dbseed.lua
| @@ -5,7 +5,6 @@ require "GlobalVar" | @@ -5,7 +5,6 @@ require "GlobalVar" | ||
| 5 | require "RedisKeys" | 5 | require "RedisKeys" |
| 6 | require "ProtocolCode" | 6 | require "ProtocolCode" |
| 7 | require "skynet.manager" | 7 | require "skynet.manager" |
| 8 | -local harbor = require "skynet.harbor" | ||
| 9 | 8 | ||
| 10 | skynet = require "skynet" | 9 | skynet = require "skynet" |
| 11 | 10 | ||
| @@ -37,7 +36,7 @@ local steps = { | @@ -37,7 +36,7 @@ local steps = { | ||
| 37 | } | 36 | } |
| 38 | 37 | ||
| 39 | skynet.start(function () | 38 | skynet.start(function () |
| 40 | - redisd = harbor.queryname("REDIS") | 39 | + redisd = skynet.localname(".REDIS") |
| 41 | 40 | ||
| 42 | redisproxy = require("shared.redisproxy") | 41 | redisproxy = require("shared.redisproxy") |
| 43 | 42 |
src/services/globald.lua
| @@ -8,15 +8,14 @@ require "utils.init" | @@ -8,15 +8,14 @@ require "utils.init" | ||
| 8 | require "RedisKeys" | 8 | require "RedisKeys" |
| 9 | require "skynet.manager" | 9 | require "skynet.manager" |
| 10 | 10 | ||
| 11 | + | ||
| 11 | local ipairs = ipairs | 12 | local ipairs = ipairs |
| 12 | local table_insert = table.insert | 13 | local table_insert = table.insert |
| 13 | local tarr2tab = table.array2Table | 14 | local tarr2tab = table.array2Table |
| 14 | local string_format = string.format | 15 | local string_format = string.format |
| 15 | 16 | ||
| 16 | -local pointDataMark = {} | ||
| 17 | -local utils = {} | ||
| 18 | 17 | ||
| 19 | -local CHECK_MAIL_STATUS_INTERVAL = 60 | 18 | +local CHECK_MAIL_STATUS_INTERVAL = 100 * 60 |
| 20 | local function mailQuene() | 19 | local function mailQuene() |
| 21 | local delayEmail = tonum(redisproxy:hget("autoincrement_set", "delay_email")) | 20 | local delayEmail = tonum(redisproxy:hget("autoincrement_set", "delay_email")) |
| 22 | if delayEmail == 0 then | 21 | if delayEmail == 0 then |
| @@ -95,6 +94,8 @@ end | @@ -95,6 +94,8 @@ end | ||
| 95 | 94 | ||
| 96 | local CMD = {} | 95 | local CMD = {} |
| 97 | 96 | ||
| 97 | + | ||
| 98 | +-- 服务器缓存50条消息 | ||
| 98 | local cacheWorldMsg = {} | 99 | local cacheWorldMsg = {} |
| 99 | local CACHE_WORLD_MSG_COUNT = 50 | 100 | local CACHE_WORLD_MSG_COUNT = 50 |
| 100 | function CMD.sendWorldMsg(channel, msg) | 101 | function CMD.sendWorldMsg(channel, msg) |
| @@ -105,12 +106,12 @@ function CMD.sendWorldMsg(channel, msg) | @@ -105,12 +106,12 @@ function CMD.sendWorldMsg(channel, msg) | ||
| 105 | end | 106 | end |
| 106 | end | 107 | end |
| 107 | 108 | ||
| 108 | - | ||
| 109 | function CMD.getWorldMsg(channel) | 109 | function CMD.getWorldMsg(channel) |
| 110 | local msgs = cacheWorldMsg[channel] or {} | 110 | local msgs = cacheWorldMsg[channel] or {} |
| 111 | return msgs | 111 | return msgs |
| 112 | end | 112 | end |
| 113 | 113 | ||
| 114 | + | ||
| 114 | function CMD.start() | 115 | function CMD.start() |
| 115 | check_mail_queue() | 116 | check_mail_queue() |
| 116 | end | 117 | end |
| @@ -127,8 +128,9 @@ local function __init__() | @@ -127,8 +128,9 @@ local function __init__() | ||
| 127 | end | 128 | end |
| 128 | end | 129 | end |
| 129 | end) | 130 | end) |
| 130 | - redisd = harbor.queryname("REDIS") | ||
| 131 | - skynet.register("GLOBALD") | 131 | + redisd = skynet.localname(".REDIS") |
| 132 | + skynet.register(".GLOBALD") | ||
| 133 | + | ||
| 132 | end | 134 | end |
| 133 | 135 | ||
| 134 | skynet.start(__init__) | 136 | skynet.start(__init__) |
src/services/httpweb.lua
| @@ -13,7 +13,6 @@ mcast_util = require "services/mcast_util" | @@ -13,7 +13,6 @@ mcast_util = require "services/mcast_util" | ||
| 13 | globalCsv = require "csvdata/GlobalDefine" | 13 | globalCsv = require "csvdata/GlobalDefine" |
| 14 | 14 | ||
| 15 | local socket = require "skynet.socket" | 15 | local socket = require "skynet.socket" |
| 16 | -local harbor = require "skynet.harbor" | ||
| 17 | 16 | ||
| 18 | require "shared.init" | 17 | require "shared.init" |
| 19 | require "utils.init" | 18 | require "utils.init" |
| @@ -55,7 +54,7 @@ end | @@ -55,7 +54,7 @@ end | ||
| 55 | local CMD = require "actions.HttpAction" | 54 | local CMD = require "actions.HttpAction" |
| 56 | 55 | ||
| 57 | local function start() | 56 | local function start() |
| 58 | - redisd = harbor.queryname("REDIS") | 57 | + redisd = skynet.localname(".REDIS") |
| 59 | csvdb = sharedata.query("csvdata") | 58 | csvdb = sharedata.query("csvdata") |
| 60 | 59 | ||
| 61 | local listen_socket = socket.listen("0.0.0.0", port) | 60 | local listen_socket = socket.listen("0.0.0.0", port) |
src/services/named.lua
| @@ -35,7 +35,7 @@ if mode == "sub" then | @@ -35,7 +35,7 @@ if mode == "sub" then | ||
| 35 | skynet.ret(skynet.pack(f(...))) | 35 | skynet.ret(skynet.pack(f(...))) |
| 36 | end) | 36 | end) |
| 37 | 37 | ||
| 38 | - skynet.register(string.format("NAMED%d", id)) | 38 | + skynet.register(string.format(".NAMED%d", id)) |
| 39 | end) | 39 | end) |
| 40 | else | 40 | else |
| 41 | skynet.start(function() | 41 | skynet.start(function() |
src/services/redisd.lua
| @@ -24,5 +24,5 @@ skynet.start(function() | @@ -24,5 +24,5 @@ skynet.start(function() | ||
| 24 | skynet.ret(skynet.pack(db[string.lower(cmd)](db, ...))) | 24 | skynet.ret(skynet.pack(db[string.lower(cmd)](db, ...))) |
| 25 | end | 25 | end |
| 26 | end) | 26 | end) |
| 27 | - skynet.register "REDIS" | 27 | + skynet.register ".REDIS" |
| 28 | end) | 28 | end) |
| 29 | \ No newline at end of file | 29 | \ No newline at end of file |
src/services/watchdog.lua
| @@ -8,6 +8,7 @@ local snax = require "skynet.snax" | @@ -8,6 +8,7 @@ local snax = require "skynet.snax" | ||
| 8 | local agent_ctrl = require "services.agent_ctrl" | 8 | local agent_ctrl = require "services.agent_ctrl" |
| 9 | local xxtea = require "xxtea" | 9 | local xxtea = require "xxtea" |
| 10 | local mc = require "skynet.multicast" | 10 | local mc = require "skynet.multicast" |
| 11 | +local cluster = require "skynet.cluster" | ||
| 11 | 12 | ||
| 12 | require "ProtocolCode" | 13 | require "ProtocolCode" |
| 13 | require "GlobalVar" | 14 | require "GlobalVar" |
| @@ -15,7 +16,7 @@ require "shared.init" | @@ -15,7 +16,7 @@ require "shared.init" | ||
| 15 | require "utils.init" | 16 | require "utils.init" |
| 16 | 17 | ||
| 17 | local CMD, SOCKET = {}, {} | 18 | local CMD, SOCKET = {}, {} |
| 18 | -local globald | 19 | +local globald, pvpd |
| 19 | 20 | ||
| 20 | local pool_size = tonumber(...) | 21 | local pool_size = tonumber(...) |
| 21 | 22 | ||
| @@ -77,11 +78,15 @@ function CMD.start(conf) | @@ -77,11 +78,15 @@ function CMD.start(conf) | ||
| 77 | -- roomServer = skynet.newservice("services/roomServer") | 78 | -- roomServer = skynet.newservice("services/roomServer") |
| 78 | -- skynet.call(roomServer, "lua", "start") | 79 | -- skynet.call(roomServer, "lua", "start") |
| 79 | 80 | ||
| 81 | + skynet.newservice("services/dbseed") | ||
| 82 | + | ||
| 80 | globald = skynet.newservice("services/globald") | 83 | globald = skynet.newservice("services/globald") |
| 81 | skynet.call(globald, "lua", "start") | 84 | skynet.call(globald, "lua", "start") |
| 82 | 85 | ||
| 83 | - skynet.newservice("services/dbseed") | ||
| 84 | - | 86 | + pvpd = skynet.newservice("services/pvpd") |
| 87 | + cluster.register("pvpd", pvpd) | ||
| 88 | + local servId = tonumber(skynet.getenv("servId")) | ||
| 89 | + cluster.open("server" .. servId) | ||
| 85 | end | 90 | end |
| 86 | 91 | ||
| 87 | function CMD.forceClose(fd) | 92 | function CMD.forceClose(fd) |
| @@ -103,7 +108,7 @@ skynet.start(function() | @@ -103,7 +108,7 @@ skynet.start(function() | ||
| 103 | skynet.ret(skynet.pack(f(subcmd, ...))) | 108 | skynet.ret(skynet.pack(f(subcmd, ...))) |
| 104 | end | 109 | end |
| 105 | end) | 110 | end) |
| 106 | - skynet.register "WATCHDOG" | 111 | + skynet.register ".WATCHDOG" |
| 107 | -- 数据库服务 | 112 | -- 数据库服务 |
| 108 | redisd = skynet.newservice("services/redisd") | 113 | redisd = skynet.newservice("services/redisd") |
| 109 | 114 |