Changes in benchmark/io/http/main.cfa [ee913e0a:075b8fd]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/main.cfa
ree913e0a r075b8fd 46 46 } 47 47 48 extern void init_protocol(void); 49 extern void deinit_protocol(void); 50 48 51 //============================================================================================= 49 52 // Main … … 61 64 //=================== 62 65 // Open Socket 63 printf(" Listening on port %d\n", options.socket.port);66 printf("%ld : Listening on port %d\n", getpid(), options.socket.port); 64 67 int server_fd = socket(AF_INET, SOCK_STREAM, 0); 65 68 if(server_fd < 0) { … … 79 82 ret = bind( server_fd, (struct sockaddr *)&address, sizeof(address) ); 80 83 if(ret < 0) { 81 if(errno == 98) {84 if(errno == EADDRINUSE) { 82 85 if(waited == 0) { 83 86 printf("Waiting for port\n"); … … 109 112 options.clopts.instance = &cl; 110 113 114 111 115 int pipe_cnt = options.clopts.nworkers * 2; 112 116 int pipe_off; … … 124 128 { 125 129 ServerProc procs[options.clopts.nprocs]; 130 131 init_protocol(); 126 132 { 127 133 Worker workers[options.clopts.nworkers]; … … 151 157 printf("Shutting Down\n"); 152 158 } 159 160 for(i; options.clopts.nworkers) { 161 printf("Cancelling %p\n", (void*)workers[i].cancel.target); 162 workers[i].done = true; 163 cancel(workers[i].cancel); 164 } 165 166 printf("Shutting down socket\n"); 167 int ret = shutdown( server_fd, SHUT_RD ); 168 if( ret < 0 ) { abort( "shutdown error: (%d) %s\n", (int)errno, strerror(errno) ); } 169 170 //=================== 171 // Close Socket 172 printf("Closing Socket\n"); 173 ret = close( server_fd ); 174 if(ret < 0) { 175 abort( "close socket error: (%d) %s\n", (int)errno, strerror(errno) ); 176 } 153 177 } 154 178 printf("Workers Closed\n"); 179 180 deinit_protocol(); 155 181 } 156 182 … … 162 188 } 163 189 free(fds); 164 }165 190 166 //===================167 // Close Socket168 printf("Closing Socket\n");169 ret = close( server_fd );170 if(ret < 0) {171 abort( "close socket error: (%d) %s\n", (int)errno, strerror(errno) );172 191 } 173 192
Note: See TracChangeset
for help on using the changeset viewer.