X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=http_send.c;h=1d970a5df561a3395effa19abf0960a70af9c3ef;hp=f0c9851fbe722889a46f12ff39741a7298b5929f;hb=60216e4058f4ecc24467df577e51cb2bd66508b0;hpb=786010c598f79d20280e6ea9ea458cad4a7e9af7 diff --git a/http_send.c b/http_send.c index f0c9851f..1d970a5d 100644 --- a/http_send.c +++ b/http_send.c @@ -208,11 +208,11 @@ static void http_send( long unsigned current_chunk, continue; if (hc->status == HTTP_READY_TO_STREAM) { int hlen; - char *buf = afs_get_header(&hlen); - if (buf && hlen > 0 && current_chunk) { + char *hbuf = afs_get_header(&hlen); + if (hbuf && hlen > 0 && current_chunk) { /* need to send header */ PARA_INFO_LOG("queueing header: %d\n", hlen); - if (queue_packet(hc, buf, hlen) < 0) + if (queue_packet(hc, hbuf, hlen) < 0) continue; } else PARA_INFO_LOG("%s", "no need to queue header\n"); @@ -371,12 +371,19 @@ static void http_pre_select(int *max_fileno, fd_set *rfds, fd_set *wfds) static int open_tcp_port(int port) { + int ret; + server_fd = init_tcp_socket(port); if (server_fd < 0) { http_shutdown_clients(); self->status = SENDER_OFF; return server_fd; } + ret = mark_fd_nonblock(server_fd); + if (ret < 0) { + PARA_EMERG_LOG("%s\n", PARA_STRERROR(-ret)); + exit(EXIT_FAILURE); + } self->status = SENDER_ON; add_close_on_fork_list(server_fd); return 1;