Changeset - 81f92ae54ec0
[Not reviewed]
default
0 3 0
Ethan Zonca (ethanzonca) - 15 years ago 2010-06-07 20:24:32
e@ethanzonca.com
Moved watchdog to mysql
3 files changed with 15 insertions and 17 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -78,13 +78,12 @@ struct general_info
 
/* *********************************************
 
   Function Prototypes
 
   ********************************************* */
 

	
 
/* ************General Functions************* */
 
int distrend_do();
 
void frame_watchdog(struct distrenjob *distrenjob_head);
 
int distrend_do_config(int argc, char *argv[], struct distrend_config **config);
 
int distrend_config_free(struct distrend_config *config);
 

	
 
/* **************XML Functions**************** */
 
void update_general_info(struct general_info *geninfo);
 
int import_general_info(struct general_info *general_info);
 
@@ -157,13 +156,13 @@ int main(int argc, char *argv[])
 
    {
 
      int clientsays = 0; /*< temporary example variable, will be replaced when we can handle messages */
 

	
 
      distrend_accept(general_info.config, clients);
 

	
 
      /* Make the following code more event-driven */
 
      frame_watchdog(&general_info.head);
 
      frame_watchdog(general_info.conn);
 

	
 
      struct frameset frame;
 
      struct distrenjob *job;
 
      distrenjob_new(&job);
 

	
 
      memset(&frame, '\0', sizeof(frame));
 
@@ -208,27 +207,12 @@ int main(int argc, char *argv[])
 
*/
 
int distrend_do()
 
{
 
  return 0;
 
}
 

	
 

	
 
/** Checks for dead, latent, or stale slaves */
 
void frame_watchdog(struct distrenjob *distrenjob_head)
 
{
 
  // Replace with mysqlness, maybe
 
  // iterate through jobs
 
    // if the job has been started, checks by seeing if either to first or second frame has been started
 
    // FRAMESETSTATUS_UNASSIGNED
 
      // iterate through all frames for this job:
 
          //watchdog_forgiveness = seconds of forgiveness before frame is re-assigned:
 
             //   If frame is not completed within the number of seconds specified by watchdog_forgiveness
 
             //   Then change the frame status to unassigned
 
}
 

	
 

	
 
/* Grabs config info from confs */
 
int distrend_do_config(int argc, char *argv[], struct distrend_config **config)
 
{
 
  unsigned int counter;
 

	
 
  cfg_opt_t myopts_listen[] =
src/server/mysql.c
Show inline comments
 
@@ -379,6 +379,15 @@ int auth_slave(distrend_mysql_conn_t con
 
  rtn = distrend_mysql_getint(row, 0, (int32_t *)isAuth);
 
  
 
  mysqlResultFree(conn, result);
 

	
 
  return rtn;
 
}
 

	
 
/** Runs frame watchdog to reassign stale frames */
 
void frame_watchdog(distrend_mysql_conn_t conn)
 
{
 
  char *query;
 
  _distren_asprintf(&query, "CALL `distren`.`Watchdog_Delete`()");
 
  mysqlQuery(conn, query, 0);
 
  free(query);
 
}
src/server/mysql.h
Show inline comments
 
@@ -74,8 +74,13 @@ int find_jobframe(distrend_mysql_conn_t 
 
/**
 
  Auth Slave: Checks username/password of slave
 
*/
 
int auth_slave(distrend_mysql_conn_t conn, int32_t slavekey, char *slavepass);
 

	
 

	
 
/**
 
  Frame Watchdog: Reassigns stale frames on server
 
*/
 
void frame_watchdog(distrend_mysql_conn_t conn);
 

	
 

	
 
#endif /* MYSQL_H_ */
0 comments (0 inline, 0 general)