Changeset 402658b1 for benchmark/io/http/main.cfa
- Timestamp:
- Jan 13, 2021, 10:23:07 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 9153e53
- Parents:
- bace538 (diff), a00bc5b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/main.cfa
rbace538 r402658b1 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.