mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-23 19:43:09 +00:00
set nodelay, see issue #763
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
local skynet = require "skynet"
|
||||
local socket = require "skynet.socket"
|
||||
local socketdriver = require "skynet.socketdriver"
|
||||
require "skynet.manager" -- import skynet.launch, ...
|
||||
local table = table
|
||||
|
||||
@@ -41,6 +42,7 @@ local function connect_slave(slave_id, address)
|
||||
local ok, err = pcall(function()
|
||||
if slaves[slave_id] == nil then
|
||||
local fd = assert(socket.open(address), "Can't connect to "..address)
|
||||
socketdriver.nodelay(fd)
|
||||
skynet.error(string.format("Connect to harbor %d (fd=%d), %s", slave_id, fd, address))
|
||||
slaves[slave_id] = fd
|
||||
monitor_clear(slave_id)
|
||||
@@ -249,6 +251,7 @@ skynet.start(function()
|
||||
local co = coroutine.running()
|
||||
socket.start(slave_fd, function(fd, addr)
|
||||
skynet.error(string.format("New connection (fd = %d, %s)",fd, addr))
|
||||
socketdriver.nodelay(fd)
|
||||
if pcall(accept_slave,fd) then
|
||||
local s = 0
|
||||
for k,v in pairs(slaves) do
|
||||
|
||||
Reference in New Issue
Block a user