Changeset 3974 for neercs


Ignore:
Timestamp:
Nov 20, 2009, 1:27:05 PM (10 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Moved client initialisation to client.c
Location:
neercs/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • neercs/trunk/src/client.c

    r3954 r3974  
    3737
    3838#define NEERCS_RECV_BUFSIZE 128*1024
     39
     40
     41int start_client(struct screen_list * screen_list)
     42{
     43    char *sess = NULL;
     44    create_socket(screen_list, SOCK_CLIENT);
     45    while ((sess = connect_socket(screen_list, SOCK_SERVER)) == NULL)
     46        usleep(100);
     47    free(sess);
     48
     49    /* Create main canvas and associated caca window */
     50    screen_list->cv = caca_create_canvas(0, 0);
     51    screen_list->dp = caca_create_display(screen_list->cv);
     52
     53    if (!screen_list->dp)
     54        return -3;
     55
     56    caca_set_display_time(screen_list->dp, screen_list->delay * 1000);
     57    caca_set_cursor(screen_list->dp, 1);
     58
     59    request_attach(screen_list);
     60   
     61    return 0;
     62}
     63
     64
    3965
    4066void mainloop(struct screen_list *screen_list)
  • neercs/trunk/src/main.c

    r3973 r3974  
    158158        debug("Spawning a new server");
    159159        if (start_server(screen_list))
     160            goto end;
     161        if (start_client(screen_list))
    160162            goto end;
    161163    }
  • neercs/trunk/src/neercs.h

    r3946 r3974  
    243243void free_screen_list(struct screen_list *screen_list);
    244244
     245int start_client(struct screen_list * screen_list);
    245246void mainloop(struct screen_list *screen_list);
    246247
  • neercs/trunk/src/server.c

    r3972 r3974  
    531531{
    532532    pid_t pid;
    533     char *sess;
    534533
    535534    pid = fork();
     
    573572    }
    574573   
    575    
    576     create_socket(screen_list, SOCK_CLIENT);
    577     while ((sess = connect_socket(screen_list, SOCK_SERVER)) == NULL)
    578         usleep(100);
    579     free(sess);
    580 
    581     /* Create main canvas and associated caca window */
    582     screen_list->cv = caca_create_canvas(0, 0);
    583     screen_list->dp = caca_create_display(screen_list->cv);
    584 
    585     if (!screen_list->dp)
    586         return -3;
    587 
    588     caca_set_display_time(screen_list->dp, screen_list->delay * 1000);
    589     caca_set_cursor(screen_list->dp, 1);
    590 
    591     request_attach(screen_list);
    592 
    593574    return 0;
    594575}
Note: See TracChangeset for help on using the changeset viewer.