Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
7d69a352
Commit
7d69a352
authored
Nov 06, 2006
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb - bug#24011
ndb/src/common/util/socket_io.cpp: Fix problem with cut sockmessages
parent
92deb8e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
33 deletions
+51
-33
ndb/src/common/util/socket_io.cpp
ndb/src/common/util/socket_io.cpp
+51
-33
No files found.
ndb/src/common/util/socket_io.cpp
View file @
7d69a352
...
@@ -53,10 +53,6 @@ readln_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
...
@@ -53,10 +53,6 @@ readln_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
if
(
buflen
<=
1
)
if
(
buflen
<=
1
)
return
0
;
return
0
;
int
sock_flags
=
fcntl
(
socket
,
F_GETFL
);
if
(
fcntl
(
socket
,
F_SETFL
,
sock_flags
|
O_NONBLOCK
)
==
-
1
)
return
-
1
;
fd_set
readset
;
fd_set
readset
;
FD_ZERO
(
&
readset
);
FD_ZERO
(
&
readset
);
FD_SET
(
socket
,
&
readset
);
FD_SET
(
socket
,
&
readset
);
...
@@ -71,43 +67,65 @@ readln_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
...
@@ -71,43 +67,65 @@ readln_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
}
}
if
(
selectRes
==
-
1
){
if
(
selectRes
==
-
1
){
fcntl
(
socket
,
F_SETFL
,
sock_flags
);
return
-
1
;
}
buf
[
0
]
=
0
;
const
int
t
=
recv
(
socket
,
buf
,
buflen
,
MSG_PEEK
);
if
(
t
<
1
)
{
fcntl
(
socket
,
F_SETFL
,
sock_flags
);
return
-
1
;
return
-
1
;
}
}
for
(
int
i
=
0
;
i
<
t
;
i
++
)
char
*
ptr
=
buf
;
int
len
=
buflen
;
do
{
{
if
(
buf
[
i
]
==
'\n'
){
int
t
;
recv
(
socket
,
buf
,
i
+
1
,
0
);
while
((
t
=
recv
(
socket
,
ptr
,
len
,
MSG_PEEK
))
==
-
1
&&
errno
==
EINTR
);
buf
[
i
]
=
0
;
if
(
t
<
1
)
{
return
-
1
;
}
if
(
i
>
0
&&
buf
[
i
-
1
]
==
'\r'
){
i
--
;
for
(
int
i
=
0
;
i
<
t
;
i
++
)
buf
[
i
]
=
0
;
{
if
(
ptr
[
i
]
==
'\n'
)
{
/**
* Now consume
*/
for
(
len
=
1
+
i
;
len
;
)
{
while
((
t
=
recv
(
socket
,
ptr
,
len
,
0
))
==
-
1
&&
errno
==
EINTR
);
if
(
t
<
1
)
return
-
1
;
ptr
+=
t
;
len
-=
t
;
}
ptr
[
0
]
=
0
;
return
ptr
-
buf
;
}
}
fcntl
(
socket
,
F_SETFL
,
sock_flags
);
return
t
;
}
}
}
for
(
int
tmp
=
t
;
tmp
;
)
if
(
t
==
(
buflen
-
1
)){
{
recv
(
socket
,
buf
,
t
,
0
);
while
((
t
=
recv
(
socket
,
ptr
,
tmp
,
0
))
==
-
1
&&
errno
==
EINTR
);
buf
[
t
]
=
0
;
if
(
t
<
1
)
fcntl
(
socket
,
F_SETFL
,
sock_flags
);
{
return
buflen
;
return
-
1
;
}
}
ptr
+=
t
;
len
-=
t
;
tmp
-=
t
;
}
return
0
;
FD_ZERO
(
&
readset
);
FD_SET
(
socket
,
&
readset
);
timeout
.
tv_sec
=
(
timeout_millis
/
1000
);
timeout
.
tv_usec
=
(
timeout_millis
%
1000
)
*
1000
;
const
int
selectRes
=
select
(
socket
+
1
,
&
readset
,
0
,
0
,
&
timeout
);
if
(
selectRes
!=
1
){
return
-
1
;
}
}
while
(
len
>
0
);
return
-
1
;
}
}
extern
"C"
extern
"C"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment