Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
67c06fd4
Commit
67c06fd4
authored
10 years ago
by
Konstantin Osipov
Browse files
Options
Downloads
Patches
Plain Diff
bsdsocket: always assume the socket is ready
parent
18462a6b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lua/bsdsocket.lua
+15
-12
15 additions, 12 deletions
src/lua/bsdsocket.lua
with
15 additions
and
12 deletions
src/lua/bsdsocket.lua
+
15
−
12
View file @
67c06fd4
...
@@ -561,15 +561,9 @@ local function readchunk(self, limit, timeout)
...
@@ -561,15 +561,9 @@ local function readchunk(self, limit, timeout)
return
data
return
data
end
end
while
t
imeout
>
0
do
while
t
rue
do
local
started
=
fiber
.
time
()
local
started
=
fiber
.
time
()
if
not
self
:
readable
(
timeout
)
then
return
nil
end
timeout
=
timeout
-
(
fiber
.
time
()
-
started
)
local
to_read
local
to_read
if
limit
~=
LIMIT_INFINITY
and
limit
>
READAHEAD
then
if
limit
~=
LIMIT_INFINITY
and
limit
>
READAHEAD
then
to_read
=
limit
-
self
.
rlen
to_read
=
limit
-
self
.
rlen
...
@@ -588,11 +582,18 @@ local function readchunk(self, limit, timeout)
...
@@ -588,11 +582,18 @@ local function readchunk(self, limit, timeout)
self
.
rpos
=
self
.
rpos
+
limit
self
.
rpos
=
self
.
rpos
+
limit
return
data
return
data
end
end
elseif
not
errno_is_transient
[
self
:
errno
()]
then
elseif
not
errno_is_transient
[
self
:
errno
()]
then
self
.
_errno
=
boxerrno
()
self
.
_errno
=
boxerrno
()
return
nil
return
nil
end
end
if
not
self
:
readable
(
timeout
)
then
return
nil
end
if
timeout
<=
0
then
break
end
timeout
=
timeout
-
(
fiber
.
time
()
-
started
)
end
end
self
.
_errno
=
boxerrno
.
ETIMEDOUT
self
.
_errno
=
boxerrno
.
ETIMEDOUT
return
nil
return
nil
...
@@ -680,7 +681,7 @@ end
...
@@ -680,7 +681,7 @@ end
socket_methods
.
read
=
function
(
self
,
opts
,
timeout
)
socket_methods
.
read
=
function
(
self
,
opts
,
timeout
)
check_socket
(
self
)
check_socket
(
self
)
timeout
=
timeout
and
tonumber
(
timeout
)
or
TIMEOUT_INFINITY
timeout
=
timeout
or
TIMEOUT_INFINITY
if
type
(
opts
)
==
'number'
then
if
type
(
opts
)
==
'number'
then
return
readchunk
(
self
,
opts
,
timeout
)
return
readchunk
(
self
,
opts
,
timeout
)
elseif
type
(
opts
)
==
'string'
then
elseif
type
(
opts
)
==
'string'
then
...
@@ -706,9 +707,7 @@ socket_methods.write = function(self, octets, timeout)
...
@@ -706,9 +707,7 @@ socket_methods.write = function(self, octets, timeout)
end
end
local
started
=
fiber
.
time
()
local
started
=
fiber
.
time
()
while
timeout
>
0
and
self
:
writable
(
timeout
)
do
while
true
do
timeout
=
timeout
-
(
fiber
.
time
()
-
started
)
local
written
=
self
:
syswrite
(
octets
)
local
written
=
self
:
syswrite
(
octets
)
if
written
==
nil
then
if
written
==
nil
then
if
not
errno_is_transient
[
self
:
errno
()]
then
if
not
errno_is_transient
[
self
:
errno
()]
then
...
@@ -722,6 +721,10 @@ socket_methods.write = function(self, octets, timeout)
...
@@ -722,6 +721,10 @@ socket_methods.write = function(self, octets, timeout)
if
written
>
0
then
if
written
>
0
then
octets
=
string.sub
(
octets
,
written
+
1
)
octets
=
string.sub
(
octets
,
written
+
1
)
end
end
timeout
=
timeout
-
(
fiber
.
time
()
-
started
)
if
timeout
<=
0
or
self
:
writable
(
timeout
)
then
break
end
end
end
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment