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
60ad1218
Commit
60ad1218
authored
10 years ago
by
Maxime Graulich
Browse files
Options
Downloads
Patches
Plain Diff
ONELAB2: fix sendAllParameters
parent
4b8a4dd9
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
contrib/onelab2/OnelabProtocol.cpp
+25
-0
25 additions, 0 deletions
contrib/onelab2/OnelabProtocol.cpp
contrib/onelab2/OnelabProtocol.h
+1
-0
1 addition, 0 deletions
contrib/onelab2/OnelabProtocol.h
contrib/onelab2/OnelabServer.cpp
+4
-3
4 additions, 3 deletions
contrib/onelab2/OnelabServer.cpp
with
30 additions
and
3 deletions
contrib/onelab2/OnelabProtocol.cpp
+
25
−
0
View file @
60ad1218
...
@@ -39,6 +39,31 @@ unsigned short OnelabProtocol::encodeMsg(UInt8 *buff, UInt32 len)
...
@@ -39,6 +39,31 @@ unsigned short OnelabProtocol::encodeMsg(UInt8 *buff, UInt32 len)
encode
(
sizeptr
,
_size
);
encode
(
sizeptr
,
_size
);
return
(
unsigned
short
)(
ptr
-
buff
);
return
(
unsigned
short
)(
ptr
-
buff
);
}
}
unsigned
short
OnelabProtocol
::
encodeMsgs
(
UInt8
*
buff
,
UInt32
len
)
{
if
(
len
<
4
)
throw
ERROR_BUFFER_TOO_SMALL
;
if
(
!
attrs
.
size
())
return
0
;
UInt8
*
ptr
=
encode
(
buff
,
(
UInt8
)
ONELAB_VERSION
);
ptr
=
encode
(
ptr
,
_type
);
UInt8
*
sizeptr
=
ptr
;
_size
=
0
;
ptr
=
encode
(
sizeptr
,
_size
);
while
(
attrs
.
size
()
>
0
)
{
OnelabAttr
*
attr
=
attrs
.
back
();
UInt16
attrLen
=
attr
->
getAttributeLength
();
if
(
4
+
_size
+
attrLen
>
len
)
{
encode
(
sizeptr
,
_size
);
return
(
unsigned
short
)(
ptr
-
buff
);
}
ptr
=
attr
->
encodeAttribute
(
ptr
);
if
(
!
attr
->
isInDatabase
())
delete
attr
;
attrs
.
pop_back
();
_size
+=
attrLen
+
4
;
}
encode
(
sizeptr
,
_size
);
return
(
unsigned
short
)(
ptr
-
buff
);
}
int
OnelabProtocol
::
parseHeader
(
UInt8
*
buff
,
UInt32
len
)
int
OnelabProtocol
::
parseHeader
(
UInt8
*
buff
,
UInt32
len
)
{
{
this
->
clearAttrs
();
this
->
clearAttrs
();
...
...
This diff is collapsed.
Click to expand it.
contrib/onelab2/OnelabProtocol.h
+
1
−
0
View file @
60ad1218
...
@@ -20,6 +20,7 @@ public:
...
@@ -20,6 +20,7 @@ public:
~
OnelabProtocol
()
{
clearAttrs
();}
~
OnelabProtocol
()
{
clearAttrs
();}
void
clearAttrs
();
void
clearAttrs
();
unsigned
short
encodeMsg
(
UInt8
*
buff
,
UInt32
len
);
unsigned
short
encodeMsg
(
UInt8
*
buff
,
UInt32
len
);
unsigned
short
encodeMsgs
(
UInt8
*
buff
,
UInt32
len
);
UInt32
parseMsg
(
UInt8
*
buff
,
UInt32
len
);
UInt32
parseMsg
(
UInt8
*
buff
,
UInt32
len
);
int
parseHeader
(
UInt8
*
buff
,
UInt32
len
);
int
parseHeader
(
UInt8
*
buff
,
UInt32
len
);
UInt32
parseMessage
(
UInt8
*
buff
,
UInt32
len
);
UInt32
parseMessage
(
UInt8
*
buff
,
UInt32
len
);
...
...
This diff is collapsed.
Click to expand it.
contrib/onelab2/OnelabServer.cpp
+
4
−
3
View file @
60ad1218
...
@@ -493,11 +493,12 @@ void OnelabServer::sendAllParameter(OnelabLocalNetworkClient *cli)
...
@@ -493,11 +493,12 @@ void OnelabServer::sendAllParameter(OnelabLocalNetworkClient *cli)
UInt8
buff
[
1024
];
UInt8
buff
[
1024
];
_parameterSpace
.
getAllParameters
(
ps
);
_parameterSpace
.
getAllParameters
(
ps
);
if
(
ps
.
size
()
==
0
)
return
;
if
(
ps
.
size
()
==
0
)
return
;
// FIXME ...
for
(
std
::
set
<
onelab
::
parameter
*
,
onelab
::
parameterLessThan
>::
iterator
it
=
ps
.
begin
();
it
!=
ps
.
end
();
it
++
)
for
(
std
::
set
<
onelab
::
parameter
*
,
onelab
::
parameterLessThan
>::
iterator
it
=
ps
.
begin
();
it
!=
ps
.
end
();
it
++
)
if
((
*
it
)
->
hasClient
(
cli
->
getName
()))
msg
.
attrs
.
push_back
(
*
it
);
if
((
*
it
)
->
hasClient
(
cli
->
getName
()))
msg
.
attrs
.
push_back
(
*
it
);
recvlen
=
msg
.
encodeMsg
(
buff
,
bufflen
);
while
(
recvlen
=
msg
.
encodeMsgs
(
buff
,
bufflen
))
cli
->
sendto
(
buff
,
recvlen
);
{
cli
->
sendto
(
buff
,
recvlen
);
}
}
}
void
OnelabServer
::
Run
()
void
OnelabServer
::
Run
()
...
...
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