Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
why3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
119
Issues
119
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Why3
why3
Commits
4319934f
Commit
4319934f
authored
Mar 25, 2016
by
Johannes Kanig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
achieve blocking and nonblocking without setting the socket to
nonblocking
parent
69b8ed31
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
src/driver/prove_client.ml
src/driver/prove_client.ml
+8
-7
No files found.
src/driver/prove_client.ml
View file @
4319934f
...
...
@@ -8,7 +8,6 @@ let client_connect socket_name =
end
else
begin
let
sock
=
Unix
.
socket
Unix
.
PF_UNIX
Unix
.
SOCK_STREAM
0
in
Unix
.
connect
sock
(
Unix
.
ADDR_UNIX
socket_name
);
Unix
.
set_nonblock
sock
;
socket
:=
Some
sock
end
...
...
@@ -34,14 +33,16 @@ let read_from_client =
match
!
socket
with
|
None
->
assert
false
|
Some
sock
->
if
blocking
then
let
_
=
Unix
.
select
[
sock
]
[]
[]
(
-
1
.
0
)
in
(* we only call read() if we are allowed to block or if the socket is
ready *)
let
do_read
=
blocking
||
(
let
l
,_,_
=
Unix
.
select
[
sock
]
[]
[]
0
.
0
in
l
<>
[]
)
in
if
do_read
then
let
read
=
Unix
.
read
sock
buf
0
1024
in
String
.
sub
buf
0
read
else
try
let
read
=
Unix
.
read
sock
buf
0
1024
in
String
.
sub
buf
0
read
with
Unix
.
Unix_error
((
Unix
.
EAGAIN
|
Unix
.
EWOULDBLOCK
)
,
_
,
_
)
->
""
else
""
type
answer
=
{
...
...
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