Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
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
Model registry
Operate
Environments
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
c7253cd6
Commit
c7253cd6
authored
13 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
catch more sendrecv errors + increase get() timout to 5 minutes
parent
ea454c77
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Common/GmshSocket.h
+9
-7
9 additions, 7 deletions
Common/GmshSocket.h
Common/onelab.h
+2
-2
2 additions, 2 deletions
Common/onelab.h
with
11 additions
and
9 deletions
Common/GmshSocket.h
+
9
−
7
View file @
c7253cd6
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
// WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
// WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
// ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
// ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
// OF THIS SOFTWARE.
// OF THIS SOFTWARE.
//
//
// Please report all bugs and problems to <gmsh@geuz.org>.
// Please report all bugs and problems to <gmsh@geuz.org>.
#ifndef _GMSH_SOCKET_H_
#ifndef _GMSH_SOCKET_H_
...
@@ -61,7 +61,7 @@ class GmshSocket{
...
@@ -61,7 +61,7 @@ class GmshSocket{
// that 65535: if we receive a type > 65535 we assume that we
// that 65535: if we receive a type > 65535 we assume that we
// receive data from a machine with a different byte ordering, and
// receive data from a machine with a different byte ordering, and
// we swap the bytes in the payload)
// we swap the bytes in the payload)
enum
MessageType
{
enum
MessageType
{
GMSH_START
=
1
,
GMSH_START
=
1
,
GMSH_STOP
=
2
,
GMSH_STOP
=
2
,
GMSH_INFO
=
10
,
GMSH_INFO
=
10
,
...
@@ -87,16 +87,18 @@ class GmshSocket{
...
@@ -87,16 +87,18 @@ class GmshSocket{
// the socket name
// the socket name
std
::
string
_sockname
;
std
::
string
_sockname
;
// send some data over the socket
// send some data over the socket
void
_SendData
(
const
void
*
buffer
,
int
bytes
)
int
_SendData
(
const
void
*
buffer
,
int
bytes
)
{
{
const
char
*
buf
=
(
const
char
*
)
buffer
;
const
char
*
buf
=
(
const
char
*
)
buffer
;
int
sofar
=
0
;
int
sofar
=
0
;
int
remaining
=
bytes
;
int
remaining
=
bytes
;
do
{
do
{
int
len
=
send
(
_sock
,
buf
+
sofar
,
remaining
,
0
);
int
len
=
send
(
_sock
,
buf
+
sofar
,
remaining
,
0
);
if
(
len
<
0
)
return
-
1
;
// error
sofar
+=
len
;
sofar
+=
len
;
remaining
-=
len
;
remaining
-=
len
;
}
while
(
remaining
>
0
);
}
while
(
remaining
>
0
);
return
bytes
;
}
}
// receive some data over the socket
// receive some data over the socket
int
_ReceiveData
(
void
*
buffer
,
int
bytes
)
int
_ReceiveData
(
void
*
buffer
,
int
bytes
)
...
@@ -195,7 +197,7 @@ class GmshSocket{
...
@@ -195,7 +197,7 @@ class GmshSocket{
*
swap
=
0
;
*
swap
=
0
;
if
(
_ReceiveData
(
type
,
sizeof
(
int
))){
if
(
_ReceiveData
(
type
,
sizeof
(
int
))){
if
(
*
type
<
0
)
return
0
;
if
(
*
type
<
0
)
return
0
;
if
(
*
type
>
65535
){
if
(
*
type
>
65535
){
// the data comes from a machine with different endianness and
// the data comes from a machine with different endianness and
// we must swap the bytes
// we must swap the bytes
*
swap
=
1
;
*
swap
=
1
;
...
@@ -405,7 +407,7 @@ class GmshServer : public GmshSocket{
...
@@ -405,7 +407,7 @@ class GmshServer : public GmshSocket{
CloseSocket
(
tmpsock
);
CloseSocket
(
tmpsock
);
throw
"Socket listen failed"
;
throw
"Socket listen failed"
;
}
}
// wait until we get data
// wait until we get data
int
ret
=
NonBlockingWait
(
tmpsock
,
0.5
,
timeout
);
int
ret
=
NonBlockingWait
(
tmpsock
,
0.5
,
timeout
);
if
(
ret
){
if
(
ret
){
...
@@ -447,6 +449,6 @@ class GmshServer : public GmshSocket{
...
@@ -447,6 +449,6 @@ class GmshServer : public GmshSocket{
CloseSocket
(
_sock
);
CloseSocket
(
_sock
);
return
0
;
return
0
;
}
}
};
};
#endif
#endif
This diff is collapsed.
Click to expand it.
Common/onelab.h
+
2
−
2
View file @
c7253cd6
...
@@ -743,8 +743,8 @@ namespace onelab{
...
@@ -743,8 +743,8 @@ namespace onelab{
_gmshClient
->
SendMessage
(
GmshSocket
::
GMSH_PARAM_QUERY_ALL
,
msg
.
size
(),
&
msg
[
0
]);
_gmshClient
->
SendMessage
(
GmshSocket
::
GMSH_PARAM_QUERY_ALL
,
msg
.
size
(),
&
msg
[
0
]);
while
(
1
){
while
(
1
){
// stop if we have no communications for
10 sec
s
// stop if we have no communications for
5 minute
s
int
ret
=
_gmshClient
->
Select
(
1
0
,
0
);
int
ret
=
_gmshClient
->
Select
(
50
0
,
0
);
if
(
!
ret
){
if
(
!
ret
){
_gmshClient
->
Info
(
"Timout: aborting remote get"
);
_gmshClient
->
Info
(
"Timout: aborting remote get"
);
return
false
;
return
false
;
...
...
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