WIP: server commands
This commit is contained in:
parent
057cad2bfb
commit
1256c65f62
2
Makefile
2
Makefile
|
@ -26,7 +26,7 @@ INCDIR=include
|
|||
SRCDIR=src
|
||||
DEBDIR=debian
|
||||
SERVEROBJ= $(BINDIR)/scheduler.o $(BINDIR)/server.o $(BINDIR)/localworker.o \
|
||||
$(BINDIR)/centers.o $(BINDIR)/main.o
|
||||
$(BINDIR)/centers.o $(BINDIR)/cmds.o $(BINDIR)/main.o
|
||||
CLIOBJ= $(BINDIR)/cli.o
|
||||
|
||||
.DEFAULT_GOAL:= all
|
||||
|
|
|
@ -114,6 +114,12 @@ struct {
|
|||
// Server
|
||||
//
|
||||
|
||||
struct {
|
||||
const char *name;
|
||||
void* (*func)(void*);
|
||||
const char *help;
|
||||
} typedef Command_t;
|
||||
|
||||
struct {
|
||||
pthread_t *id;
|
||||
bool pleaseStop;
|
||||
|
|
61
src/main.c
61
src/main.c
|
@ -24,18 +24,9 @@
|
|||
#include "../include/scheduler.h"
|
||||
|
||||
|
||||
#define ARROW_NUMBER 150
|
||||
#define MAX_CYCLES 15
|
||||
#define MAX_THREAD 0
|
||||
#define XMAX 1000
|
||||
#define YMAX 1000
|
||||
#define ZMAX 0
|
||||
#define SPACE_SIZE (XMAX+1) * (YMAX+1) * (ZMAX+1)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
time_t t;
|
||||
//Scheduler_t *scheduler0;
|
||||
Server_t *server0;
|
||||
|
||||
// Go!
|
||||
|
@ -47,58 +38,6 @@ int main(int argc, char **argv)
|
|||
t = time(&t);
|
||||
srand((unsigned) t);
|
||||
|
||||
//
|
||||
// Creating structure for the Scheduler
|
||||
//
|
||||
/* scheduler0 = (Scheduler_t*) calloc(1, sizeof(Scheduler_t)); */
|
||||
|
||||
/* scheduler0->globalDrawingSpace = */
|
||||
/* (Space_t*) calloc(1, sizeof(Space_t)); */
|
||||
/* scheduler0->globalDrawingSpace->space = */
|
||||
/* (SpaceUnit_t*) calloc(SPACE_SIZE, sizeof(SpaceUnit_t)); */
|
||||
/* scheduler0->globalDrawingSpace->size = SPACE_SIZE; */
|
||||
/* scheduler0->globalDrawingSpace->xmax = SPACE_SIZE; */
|
||||
/* scheduler0->globalDrawingSpace->ymax = SPACE_SIZE; */
|
||||
/* scheduler0->globalDrawingSpace->zmax = SPACE_SIZE; */
|
||||
|
||||
/* scheduler0->arrowList = (ArrowArray_t*) calloc(1, sizeof(ArrowArray_t)); */
|
||||
/* scheduler0->arrowList->array = */
|
||||
/* (Arrow_t*) calloc(ARROW_NUMBER, sizeof(Arrow_t)); */
|
||||
/* scheduler0->arrowList->size = ARROW_NUMBER; */
|
||||
|
||||
/* printLog("Populating a random arrow list...\n"); */
|
||||
/* for (int i = 0; i < ARROW_NUMBER; i++) { */
|
||||
|
||||
/* if (scheduler0->globalDrawingSpace->xmax) */
|
||||
/* scheduler0->arrowList->array[i].x = */
|
||||
/* rand() % (scheduler0->globalDrawingSpace->xmax + 1); */
|
||||
|
||||
/* if (scheduler0->globalDrawingSpace->ymax) */
|
||||
/* scheduler0->arrowList->array[i].y = */
|
||||
/* rand() % (scheduler0->globalDrawingSpace->ymax + 1); */
|
||||
|
||||
/* if (scheduler0->globalDrawingSpace->zmax) */
|
||||
/* scheduler0->arrowList->array[i].z = */
|
||||
/* rand() % (scheduler0->globalDrawingSpace->zmax + 1); */
|
||||
/* } */
|
||||
|
||||
/* scheduler0->nmaxThread = MAX_THREAD; */
|
||||
/* scheduler0->nmaxCycles = MAX_CYCLES; */
|
||||
|
||||
/* // */
|
||||
/* // Creating the Scheduler thread */
|
||||
/* // */
|
||||
/* SchedInit(scheduler0); */
|
||||
|
||||
/* SchedWait(scheduler0); */
|
||||
|
||||
/* SchedDestroy(scheduler0); */
|
||||
|
||||
/* free(scheduler0); */
|
||||
|
||||
//
|
||||
// Creating structure for the server
|
||||
//
|
||||
server0 = (Server_t*) calloc(1, sizeof(Server_t));
|
||||
|
||||
ServerInit(server0);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
//=-------------------------------------------------------------------------=//
|
||||
|
||||
#include "../include/base.h"
|
||||
#include "../include/cmds.h"
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
|
@ -82,9 +83,9 @@ static void *serverMain(void *server)
|
|||
Server_t *args;
|
||||
int socketDescriptor, effectiveSocket, clientLen;
|
||||
struct sockaddr_in client;
|
||||
|
||||
char clientRequest[255]= {0};
|
||||
char serverAnswer[255] = {0};
|
||||
|
||||
const char *pMessage = "hello";
|
||||
|
||||
// Get args
|
||||
|
|
Loading…
Reference in New Issue