时间原因,暂存部分更改
This commit is contained in:
11
c/network/erroprocess/erroprocess.c
Normal file
11
c/network/erroprocess/erroprocess.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include "erroprocess.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
int give_upjobs(indiector *self)
|
||||||
|
{
|
||||||
|
if(self == NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
20
c/network/erroprocess/erroprocess.h
Normal file
20
c/network/erroprocess/erroprocess.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#ifndef ERROPROCESS
|
||||||
|
#define EROPROCESS
|
||||||
|
typedef struct jobs
|
||||||
|
{
|
||||||
|
struct jobs* next;
|
||||||
|
int job;
|
||||||
|
}jobs;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct indiector
|
||||||
|
{
|
||||||
|
int status;//熔断标志位
|
||||||
|
int retreat_index;//退避指数
|
||||||
|
jobs *head_job;
|
||||||
|
jobs *rear_job;
|
||||||
|
}indiector;
|
||||||
|
|
||||||
|
int give_upjobs(indiector *self);
|
||||||
|
|
||||||
|
#endif
|
@ -89,6 +89,7 @@ int init_network(int port)
|
|||||||
|
|
||||||
ssize_t read_req(int fd, void *buf)
|
ssize_t read_req(int fd, void *buf)
|
||||||
{
|
{
|
||||||
|
// TODO 修改读取任务函数
|
||||||
ssize_t n = read(fd, buf, MAX_MESSAGE_BUF);
|
ssize_t n = read(fd, buf, MAX_MESSAGE_BUF);
|
||||||
if (n == 0) /* 写端已关闭,管道永不会再有数据 */
|
if (n == 0) /* 写端已关闭,管道永不会再有数据 */
|
||||||
return -1;
|
return -1;
|
||||||
@ -97,6 +98,9 @@ ssize_t read_req(int fd, void *buf)
|
|||||||
|
|
||||||
int process_message(char *req,log_manager *logger)
|
int process_message(char *req,log_manager *logger)
|
||||||
{
|
{
|
||||||
|
//TODO 修改管道命令解析
|
||||||
|
if(req[0]!='s')
|
||||||
|
return 0;
|
||||||
const char *body = http_get_body(req);
|
const char *body = http_get_body(req);
|
||||||
rbt_msg message;
|
rbt_msg message;
|
||||||
rbt_parse_json(body,&message);
|
rbt_parse_json(body,&message);
|
||||||
|
Reference in New Issue
Block a user