Changeset 2614 for neercs/trunk/src/main.c
- Timestamp:
- 07/31/08 01:34:55 (5 years ago)
- File:
-
- 1 edited
-
neercs/trunk/src/main.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
neercs/trunk/src/main.c
r2613 r2614 261 261 for(i=0; sockets[i]; i++); 262 262 i--; 263 screen_list->s _socket_path= strdup(sockets[i]);264 session = connect_s erver(screen_list);263 screen_list->socket_path[SOCK_SERVER] = strdup(sockets[i]); 264 session = connect_socket(screen_list, SOCK_SERVER); 265 265 while(!session && i > 0) 266 266 { 267 free(screen_list->s _socket_path);267 free(screen_list->socket_path[SOCK_SERVER]); 268 268 i--; 269 screen_list->s _socket_path= strdup(sockets[i]);270 session = connect_s erver(screen_list);269 screen_list->socket_path[SOCK_SERVER] = strdup(sockets[i]); 270 session = connect_socket(screen_list, SOCK_SERVER); 271 271 } 272 272 debug("Connected to session %s", session); … … 280 280 caca_set_cursor(screen_list->dp, 1); 281 281 282 screen_list->c_socket_path = build_socket_path(screen_list->socket_dir, session, 1); 283 create_client_socket(screen_list); 282 screen_list->socket_path[SOCK_CLIENT] = 283 build_socket_path(screen_list->socket_dir, session, SOCK_CLIENT); 284 create_socket(screen_list, SOCK_CLIENT); 284 285 request_attach(screen_list); 285 286 if(screen_list->session_name) … … 290 291 { 291 292 fprintf(stderr, "Failed to attach!\n"); 292 free(screen_list->s _socket_path);293 screen_list->s _socket_path= NULL;293 free(screen_list->socket_path[SOCK_SERVER]); 294 screen_list->socket_path[SOCK_SERVER] = NULL; 294 295 attach = 0; 295 296 } … … 320 321 } 321 322 } 322 if(!screen_list-> c_socket_path)323 screen_list-> c_socket_path=324 build_socket_path(screen_list->socket_dir, screen_list->session_name, 1);325 326 if(!screen_list->s _socket_path)327 screen_list->s _socket_path=328 build_socket_path(screen_list->socket_dir, screen_list->session_name, 0);323 if(!screen_list->socket_path[SOCK_CLIENT]) 324 screen_list->socket_path[SOCK_CLIENT] = 325 build_socket_path(screen_list->socket_dir, screen_list->session_name, SOCK_CLIENT); 326 327 if(!screen_list->socket_path[SOCK_SERVER]) 328 screen_list->socket_path[SOCK_SERVER] = 329 build_socket_path(screen_list->socket_dir, screen_list->session_name, SOCK_SERVER); 329 330 330 331 /* Fork the server if needed */ … … 365 366 return server_main(to_grab, to_start, screen_list); 366 367 } 367 create_ client_socket(screen_list);368 while((sess = connect_s erver(screen_list)) == NULL)368 create_socket(screen_list, SOCK_CLIENT); 369 while((sess = connect_socket(screen_list, SOCK_SERVER)) == NULL) 369 370 usleep(100); 370 371 free(sess); … … 389 390 char buf[128*1024]; 390 391 391 if (screen_list-> c_socket && (n = read(screen_list->c_socket, buf, sizeof(buf)-1)) > 0)392 if (screen_list->socket[SOCK_CLIENT] && (n = read(screen_list->socket[SOCK_CLIENT], buf, sizeof(buf)-1)) > 0) 392 393 { 393 394 buf[n] = 0; … … 445 446 } 446 447 447 if(screen_list->s _socket_path)448 free(screen_list->s _socket_path);449 450 if(screen_list-> c_socket_path)451 { 452 unlink(screen_list-> c_socket_path);453 free(screen_list-> c_socket_path);454 } 455 456 if(screen_list-> c_socket)457 close(screen_list-> c_socket);458 459 if(screen_list->s _socket)460 close(screen_list->s _socket);448 if(screen_list->socket_path[SOCK_SERVER]) 449 free(screen_list->socket_path[SOCK_SERVER]); 450 451 if(screen_list->socket_path[SOCK_CLIENT]) 452 { 453 unlink(screen_list->socket_path[SOCK_CLIENT]); 454 free(screen_list->socket_path[SOCK_CLIENT]); 455 } 456 457 if(screen_list->socket[SOCK_CLIENT]) 458 close(screen_list->socket[SOCK_CLIENT]); 459 460 if(screen_list->socket[SOCK_SERVER]) 461 close(screen_list->socket[SOCK_SERVER]); 461 462 462 463 if(screen_list->screen) … … 529 530 screen_list->lock_offset = 0; 530 531 screen_list->attached = 1; 531 screen_list->s _socket= 0;532 screen_list-> c_socket= 0;532 screen_list->socket[SOCK_SERVER] = 0; 533 screen_list->socket[SOCK_CLIENT] = 0; 533 534 screen_list->socket_dir = NULL; 534 screen_list->s _socket_path= NULL;535 screen_list-> c_socket_path= NULL;535 screen_list->socket_path[SOCK_SERVER] = NULL; 536 screen_list->socket_path[SOCK_CLIENT] = NULL; 536 537 screen_list->session_name = NULL; 537 538 screen_list->default_shell = NULL;
Note: See TracChangeset
for help on using the changeset viewer.
