Skip to content
Snippets Groups Projects
Commit d6cd60bd authored by Dmitry E. Oboukhov's avatar Dmitry E. Oboukhov
Browse files

Fix possible race condition between read/write fibers.

parent 716475e4
No related branches found
No related tags found
No related merge requests found
......@@ -284,19 +284,22 @@ box.net.box.new = function(host, port, reconnect_timeout)
if self.s ~= nil then
return true
end
self.s = box.socket.tcp()
if self.s == nil then
local sc = box.socket.tcp()
if sc == nil then
self:fatal("Can't create socket")
return false
end
local s = { self.s:connect( self.host, self.port ) }
local s = { sc:connect( self.host, self.port ) }
if s[1] == nil then
self:fatal("Can't connect to %s:%s: %s",
self.host, self.port, s[4])
return false
end
self.s = sc
return true
end,
......
......@@ -173,9 +173,9 @@ lua remote:close()
...
lua remote:close()
---
error: '[string "box.net = {..."]:399: box.net.box: already closed'
error: '[string "box.net = {..."]:402: box.net.box: already closed'
...
lua remote:ping()
---
error: '[string "box.net = {..."]:404: box.net.box: connection was closed'
error: '[string "box.net = {..."]:407: box.net.box: connection was closed'
...
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment