Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
0ee5761c
Commit
0ee5761c
authored
Jan 31, 2017
by
Mike Hibler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make subbossinfo command respect the client heartbeat sitevar.
parent
2797b4b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
2 deletions
+41
-2
tmcd/tmcd.c
tmcd/tmcd.c
+41
-2
No files found.
tmcd/tmcd.c
View file @
0ee5761c
...
...
@@ -13823,6 +13823,7 @@ COMMAND_PROTOTYPE(dosubbossinfo)
char buf[MYBUFSIZE];
char *bufp = buf, *ebufp = &buf[sizeof(buf)];
char *curservice;
int isfrisbee, fcreport = -1;
/* make sure caller is a subboss */
res = mydb_query("select erole from reserved "
...
...
@@ -13840,6 +13841,26 @@ COMMAND_PROTOTYPE(dosubbossinfo)
}
mysql_free_result(res);
/*
* XXX make sure subbosses respect sitevar for frisbee client reports.
* Note again that a heartbeat of zero means disabled.
*
* It is debatable whether this should override the attributes value.
* Right now it doesn't. It only takes effect if no frisbee
* "clientreport" attribute is specified.
*/
res = mydb_query("select value,defaultvalue from sitevariables "
"where name='images/frisbee/heartbeat'", 2);
if (res && (int)mysql_num_rows(res) > 0) {
row = mysql_fetch_row(res);
if (row[0] && row[0][0])
fcreport = atoi(row[0]);
else if (row[1] && row[1][0])
fcreport = atoi(row[1]);
}
if (res)
mysql_free_result(res);
/*
* Get info for all services, one line per service
*/
...
...
@@ -13863,6 +13884,10 @@ COMMAND_PROTOTYPE(dosubbossinfo)
}
if (curservice == NULL || strcmp(curservice, row[0]) != 0) {
if (curservice) {
if (isfrisbee && fcreport >= 0)
bufp += OUTPUT(bufp, ebufp - bufp,
" clientreport=\"%d\"",
fcreport);
OUTPUT(bufp, ebufp - buf, "\n");
client_writeback(sock, buf, strlen(buf), tcp);
bufp = buf;
...
...
@@ -13870,13 +13895,27 @@ COMMAND_PROTOTYPE(dosubbossinfo)
}
curservice = mystrdup(row[0]);
bufp += OUTPUT(bufp, ebufp - bufp, "%s", curservice);
if (strncmp(curservice, "frisbee") == 0)
isfrisbee = 1;
else
isfrisbee = 0;
}
bufp += OUTPUT(bufp, ebufp - bufp, " %s=\"%s\"",
row[1], row[2] ? row[2] : "");
/*
* Just remember frisbee clientreport value for now.
* XXX note that per subboss attribute overrides sitevar.
*/
if (isfrisbee && strncmp(row[1], "clientreport") == 0)
fcreport = row[2] ? atoi(row[2]) : -1;
else
bufp += OUTPUT(bufp, ebufp - bufp, " %s=\"%s\"",
row[1], row[2] ? row[2] : "");
}
mysql_free_result(res);
if (bufp != buf) {
if (isfrisbee && fcreport >= 0)
bufp += OUTPUT(bufp, ebufp - bufp,
" clientreport=\"%d\"", fcreport);
OUTPUT(bufp, ebufp - buf, "\n");
client_writeback(sock, buf, strlen(buf), tcp);
}
...
...
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