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
d8b05e0b
Commit
d8b05e0b
authored
May 22, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/stewart/Documents/MySQL/5.0/bug13987
into mysql.com:/home/stewart/Documents/MySQL/5.0/main
parents
095d2683
2b3f7340
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
31 deletions
+39
-31
ndb/src/common/util/socket_io.cpp
ndb/src/common/util/socket_io.cpp
+39
-31
No files found.
ndb/src/common/util/socket_io.cpp
View file @
d8b05e0b
...
@@ -53,6 +53,10 @@ readln_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
...
@@ -53,6 +53,10 @@ 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
);
...
@@ -62,44 +66,48 @@ readln_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
...
@@ -62,44 +66,48 @@ readln_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
timeout
.
tv_usec
=
(
timeout_millis
%
1000
)
*
1000
;
timeout
.
tv_usec
=
(
timeout_millis
%
1000
)
*
1000
;
const
int
selectRes
=
select
(
socket
+
1
,
&
readset
,
0
,
0
,
&
timeout
);
const
int
selectRes
=
select
(
socket
+
1
,
&
readset
,
0
,
0
,
&
timeout
);
if
(
selectRes
==
0
)
if
(
selectRes
==
0
)
{
return
0
;
return
0
;
}
if
(
selectRes
==
-
1
){
if
(
selectRes
==
-
1
){
fcntl
(
socket
,
F_SETFL
,
sock_flags
);
return
-
1
;
return
-
1
;
}
}
int
pos
=
0
;
buf
[
pos
]
=
0
;
buf
[
0
]
=
0
;
while
(
true
){
const
int
t
=
recv
(
socket
,
buf
,
buflen
,
MSG_PEEK
);
const
int
t
=
recv
(
socket
,
&
buf
[
pos
],
1
,
0
);
if
(
t
!=
1
){
if
(
t
<
1
)
{
fcntl
(
socket
,
F_SETFL
,
sock_flags
);
return
-
1
;
return
-
1
;
}
}
if
(
buf
[
pos
]
==
'\n'
){
buf
[
pos
]
=
0
;
if
(
pos
>
0
&&
buf
[
pos
-
1
]
==
'\r'
){
for
(
int
i
=
0
;
i
<
t
;
i
++
)
pos
--
;
{
buf
[
pos
]
=
0
;
if
(
buf
[
i
]
==
'\n'
){
recv
(
socket
,
buf
,
i
+
1
,
0
);
buf
[
i
]
=
0
;
if
(
i
>
0
&&
buf
[
i
-
1
]
==
'\r'
){
i
--
;
buf
[
i
]
=
0
;
}
}
return
pos
;
fcntl
(
socket
,
F_SETFL
,
sock_flags
);
return
t
;
}
}
pos
++
;
if
(
pos
==
(
buflen
-
1
)){
buf
[
pos
]
=
0
;
return
buflen
;
}
}
FD_ZERO
(
&
readset
);
if
(
t
==
(
buflen
-
1
)){
FD_SET
(
socket
,
&
readset
);
recv
(
socket
,
buf
,
t
,
0
);
timeout
.
tv_sec
=
(
timeout_millis
/
1000
);
buf
[
t
]
=
0
;
timeout
.
tv_usec
=
(
timeout_millis
%
1000
)
*
1000
;
fcntl
(
socket
,
F_SETFL
,
sock_flags
);
const
int
selectRes
=
select
(
socket
+
1
,
&
readset
,
0
,
0
,
&
timeout
);
return
buflen
;
if
(
selectRes
!=
1
){
return
-
1
;
}
}
}
return
0
;
}
}
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