~ps10gel/ubuntu/xenial/trafficserver/6.2.0

« back to all changes in this revision

Viewing changes to mgmt/api/TSControlMain.cc

  • Committer: Package Import Robot
  • Author(s): Aron Xu
  • Date: 2013-05-09 01:00:04 UTC
  • mto: (1.1.11) (5.3.3 experimental)
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: package-import@ubuntu.com-20130509010004-9fqq9n0adseg3f8w
Tags: upstream-3.3.2
ImportĀ upstreamĀ versionĀ 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
381
381
              }
382
382
              break;
383
383
 
384
 
            case STATS_RESET:
385
 
              ret = handle_stats_reset(client_entry->sock_info, req);
 
384
            case STATS_RESET_CLUSTER:
 
385
            case STATS_RESET_NODE:
 
386
              ret = handle_stats_reset(client_entry->sock_info, req, op_t);
386
387
              ats_free(req);
387
388
              if (ret == TS_ERR_NET_WRITE || ret == TS_ERR_NET_EOF) {
388
389
                Debug("ts_main", "[ts_ctrl_main] ERROR: stats_reset\n");
1000
1001
 * purpose: handles request to reset statistics to default values
1001
1002
 * input: struct SocketInfo sock_info - the socket to use to talk to client
1002
1003
 *        req - should be NULL
 
1004
 *        op - reset type (cluster or node)
1003
1005
 * output: TS_ERR_xx
1004
1006
 *************************************************************************/
1005
1007
TSError
1006
 
handle_stats_reset(struct SocketInfo sock_info, char *req)
 
1008
handle_stats_reset(struct SocketInfo sock_info, char *req, OpType op)
1007
1009
{
1008
 
  int16_t cluster;
1009
1010
  TSError ret;
1010
1011
 
1011
 
  if (!req) {
1012
 
    ret = send_reply(sock_info, TS_ERR_PARAMS);
1013
 
    return ret;                 // shouldn't get here
1014
 
  }
1015
 
 
1016
 
  // the req should be a boolean value - typecase it
1017
 
  memcpy(&cluster, req, SIZE_BOOL);
1018
 
 
1019
 
  // call CoreAPI call on Traffic Manager side
1020
 
  ret = StatsReset(0 != cluster);
 
1012
  ret = StatsReset(op == STATS_RESET_CLUSTER, req);
1021
1013
  ret = send_reply(sock_info, ret);
1022
1014
 
1023
1015
  return ret;