X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fevent_client.c;h=c7e314db43ba675eaf9bf2abe21e60320afa9945;hb=3b1a3e6685b0c1b21373eea9ba3e11b95ca4332c;hp=68e59cc1f11a36da456117a8d2b506b70e4a4f43;hpb=9136591216fde408d9b4836b586f9d797f297663;p=citadel.git diff --git a/citadel/event_client.c b/citadel/event_client.c index 68e59cc1f..c7e314db4 100644 --- a/citadel/event_client.c +++ b/citadel/event_client.c @@ -227,15 +227,12 @@ void StopClientWatchers(AsyncIO *IO) ev_io_stop(event_base, &IO->conn_event); ev_idle_stop(event_base, &IO->unwind_stack); - if (IO->SendBuf.fd != 0) - { - ev_io_stop(event_base, &IO->send_event); - ev_io_stop(event_base, &IO->recv_event); - ev_timer_stop (event_base, &IO->rw_timeout); - close(IO->SendBuf.fd); - IO->SendBuf.fd = 0; - IO->RecvBuf.fd = 0; - } + ev_io_stop(event_base, &IO->send_event); + ev_io_stop(event_base, &IO->recv_event); + ev_timer_stop (event_base, &IO->rw_timeout); + close(IO->SendBuf.fd); + IO->SendBuf.fd = 0; + IO->RecvBuf.fd = 0; } void ShutDownCLient(AsyncIO *IO) @@ -355,48 +352,21 @@ IO_send_callback(struct ev_loop *loop, ev_io *watcher, int revents) IO->SendBuf.fd); fd = fopen(fn, "a+"); - fprintf(fd, "Read: BufSize: %ld BufContent: [", + fprintf(fd, "Send: BufSize: %ld BufContent: [", nbytes); rv = fwrite(pchh, nbytes, 1, fd); if (!rv) printf("failed to write debug to %s!\n", fn); fprintf(fd, "]\n"); - - - fclose(fd); - } #endif - rc = StrBuf_write_one_chunk_callback(watcher->fd, 0/*TODO*/, &IO->SendBuf); + rc = StrBuf_write_one_chunk_callback(watcher->fd, 0/*TODO*/, &IO->SendBuf); - if (rc == 0) - { #ifdef BIGBAD_IODBG - { - int rv = 0; - char fn [SIZ]; - FILE *fd; - const char *pch = ChrPtr(IO->SendBuf.Buf); - const char *pchh = IO->SendBuf.ReadWritePointer; - long nbytes; - - if (pchh == NULL) - pchh = pch; - - nbytes = StrLength(IO->SendBuf.Buf) - (pchh - pch); - snprintf(fn, SIZ, "/tmp/foolog_ev_%s.%d", - ((CitContext*)(IO->CitContext))->ServiceName, - IO->SendBuf.fd); - - fd = fopen(fn, "a+"); - fprintf(fd, "Read: BufSize: %ld BufContent: [", - nbytes); - rv = fwrite(pchh, nbytes, 1, fd); - if (!rv) printf("failed to write debug to %s!\n", fn); - fprintf(fd, "]\n"); - - - fclose(fd); - } + fprintf(fd, "Sent: BufSize: %d bytes.\n", rc); + fclose(fd); + } #endif + if (rc == 0) + { ev_io_stop(event_base, &IO->send_event); switch (IO->NextState) { case eSendMore: