- From: Desrochers, Gary <Gary.Desrochers@fmr.com>
- Date: Mon, 12 Jun 2000 08:44:58 -0400
- To: www-lib@w3.org
Good Morning, At the end of this mail are the last couple of patches that I have. I think this is all. I also have a routine which I have not generated a patch for but that works great. It is a method which resets libwww to the state it was in just prior to the first call to HTEventList_loop. The routine should be in HTLib.c. /* ** This function cleans up all connections without shuting down ** Libwww. The state of the library just prior to calling ** HTEventList_loop for the first time. ** If the library looks to be in a "bad" state then this routine ** Attempts to clean up any problems. */ PUBLIC BOOL void HTLibReset(void) { HTNet_deleteAll(); HTHost_deleteAll(); HTChannel_deleteAll(); HTAnchor_deleteAll(NULL); HTEventList_unregisterAll(); HTTimer_deleteAll(); /* Lets make sure the sockets are now zero. There is a bug in libwww which looses persistent and non-persistent sockets. I haven't been able to fix it yet so fix it here. */ while(HTNet_availablePersistentSockets() < HTNet_maxSocket()-2) HTNet_decreasePersistentSocket(); while(HTNet_availableSockets() < HTNet_maxSocket()) HTNet_decreaseSocket(); return; } -------------------------- patch ----- cut here ----------------- diff -c -r -X excludedfiles libwww/Library/src/HTEvtLst.c libwww.AIX.copy/Library/src/HTEvtLst.c *** libwww/Library/src/HTEvtLst.c Mon Aug 9 10:18:10 1999 --- libwww.AIX.copy/Library/src/HTEvtLst.c Wed Feb 9 14:14:31 2000 *************** *** 65,70 **** --- 65,71 ---- PRIVATE HTList * EventOrderList = NULL; PRIVATE int HTEndLoop = 0; /* If !0 then exit event loop */ PRIVATE BOOL HTInLoop = NO; + PRIVATE BOOL HTAllowInfiniteTimeout = YES; #ifdef WWW_WIN_ASYNC #define TIMEOUT 1 /* WM_TIMER id */ *************** *** 208,234 **** SockEvents * sockp = (SockEvents *) param; HTEvent * event = NULL; /* Check for read timeout */ if (sockp->timeouts[HTEvent_INDEX(HTEvent_READ)] == timer) { event = sockp->events[HTEvent_INDEX(HTEvent_READ)]; HTTRACE(THD_TRACE, "Event....... READ timed out on %d.\n" _ sockp->s); ! return (*event->cbf) (sockp->s, event->param, HTEvent_TIMEOUT); } /* Check for write timeout */ if (sockp->timeouts[HTEvent_INDEX(HTEvent_WRITE)] == timer) { event = sockp->events[HTEvent_INDEX(HTEvent_WRITE)]; HTTRACE(THD_TRACE, "Event....... WRITE timed out on %d.\n" _ sockp->s); ! return (*event->cbf) (sockp->s, event->param, HTEvent_TIMEOUT); } /* Check for out-of-band data timeout */ if (sockp->timeouts[HTEvent_INDEX(HTEvent_OOB)] == timer) { event = sockp->events[HTEvent_INDEX(HTEvent_OOB)]; HTTRACE(THD_TRACE, "Event....... OOB timed out on %d.\n" _ sockp->s); ! return (*event->cbf) (sockp->s, event->param, HTEvent_TIMEOUT); } ! HTTRACE(THD_TRACE, "Event....... No event for timer %p with context %p\n" _ timer _ param); return HT_ERROR; } --- 209,278 ---- SockEvents * sockp = (SockEvents *) param; HTEvent * event = NULL; + /* Check the parameters */ + if(param == NULL) + { + HTTRACE(THD_TRACE, "Event....... NULL Param for timer %p.\n" _ timer); + return HT_ERROR; + } + + if(timer == NULL) + { + HTTRACE(THD_TRACE, "Event....... NULL timer for param %p.\n" _ param); + return HT_ERROR; + } + + /* No need to check the type parameter. */ + /* Check for read timeout */ if (sockp->timeouts[HTEvent_INDEX(HTEvent_READ)] == timer) { event = sockp->events[HTEvent_INDEX(HTEvent_READ)]; HTTRACE(THD_TRACE, "Event....... READ timed out on %d.\n" _ sockp->s); ! HTTRACE(THD_TRACE, "Event....... READ calling event %p and its cbf %p\n" _ ! (void *)event _ (void *) event->cbf); ! if(event && event->cbf) ! return (*event->cbf) (sockp->s, event->param, HTEvent_TIMEOUT); ! else ! { ! HTTRACE(THD_TRACE, "Event....... READ event NULL for timer %p with context %p\n" _ ! timer _ param); ! return HT_ERROR; ! } } /* Check for write timeout */ if (sockp->timeouts[HTEvent_INDEX(HTEvent_WRITE)] == timer) { event = sockp->events[HTEvent_INDEX(HTEvent_WRITE)]; HTTRACE(THD_TRACE, "Event....... WRITE timed out on %d.\n" _ sockp->s); ! HTTRACE(THD_TRACE, "Event....... WRITE calling event %p and its cbf %p\n" _ ! (void *)event _ (void *) event->cbf); ! if(event && event->cbf) ! return (*event->cbf) (sockp->s, event->param, HTEvent_TIMEOUT); ! else ! { ! HTTRACE(THD_TRACE, "Event....... WRITE event NULL for timer %p with context %p\n" _ ! timer _ param); ! return HT_ERROR; ! } } /* Check for out-of-band data timeout */ if (sockp->timeouts[HTEvent_INDEX(HTEvent_OOB)] == timer) { event = sockp->events[HTEvent_INDEX(HTEvent_OOB)]; HTTRACE(THD_TRACE, "Event....... OOB timed out on %d.\n" _ sockp->s); ! HTTRACE(THD_TRACE, "Event....... OOB calling event %p and its cbf %p\n" _ ! (void *)event _ (void *) event->cbf); ! if(event && event->cbf) ! return (*event->cbf) (sockp->s, event->param, HTEvent_TIMEOUT); ! else ! { ! HTTRACE(THD_TRACE, "Event....... OOB event NULL for timer %p with context %p\n" _ ! timer _ param); ! return HT_ERROR; } ! } ! HTTRACE(THD_TRACE, "Event....... No event for timer %p with context %p\n" _ ! timer _ param); return HT_ERROR; } *************** *** 366,372 **** FD_ISSET(cnt, (FdArray + HTEvent_INDEX(HTEvent_OOB)))) if (cnt > t_max) t_max = cnt; } ! MaxSock = t_max+1; HTTRACE(THD_TRACE, "Event....... Reset MaxSock from %u to %u\n" _ old_max _ MaxSock); return; } --- 410,416 ---- FD_ISSET(cnt, (FdArray + HTEvent_INDEX(HTEvent_OOB)))) if (cnt > t_max) t_max = cnt; } ! MaxSock = t_max; HTTRACE(THD_TRACE, "Event....... Reset MaxSock from %u to %u\n" _ old_max _ MaxSock); return; } *************** *** 607,612 **** --- 651,676 ---- } /* + ** In the event loop turn off the infinite timeout ability. + ** Default is to allow infinite timeouts. + ** If infinite timeouts are turned off an HT_ERROR is returned. + */ + PUBLIC void HTEventList_NoInfiniteTimeout (void) + { + HTAllowInfiniteTimeout = NO; + } + + /* + ** In the event loop turn on the infinite timeout ability. + ** Default is to allow infinite timeouts. + ** If infinite timeouts are turned off an HT_ERROR is returned. + */ + PUBLIC void HTEventList_InfiniteTimeout (void) + { + HTAllowInfiniteTimeout = YES; + } + + /* ** There are now two versions of the event loop. The first is if you want ** to use async I/O on windows, and the other is if you want to use normal ** Unix setup with sockets *************** *** 669,675 **** waittime.tv_usec = (timeout % MILLI_PER_SECOND) * (1000000 / MILLI_PER_SECOND); wt = &waittime; ! } /* ** Now we copy the current active file descriptors to pass them to select. --- 733,747 ---- waittime.tv_usec = (timeout % MILLI_PER_SECOND) * (1000000 / MILLI_PER_SECOND); wt = &waittime; ! }else ! { ! if(HTAllowInfiniteTimeout == NO) ! { ! /* What about no timers with a request passed? We go forever? */ ! status = HT_ERROR; ! break; /* Why do you need goto's when a break gets to stop_loop? */ ! } ! } /* ** Now we copy the current active file descriptors to pass them to select. *************** *** 679,685 **** texceptset = FdArray[HTEvent_INDEX(HTEvent_OOB)]; /* And also get the max socket value */ ! maxfds = MaxSock; HTTRACE(THD_TRACE, "Event Loop.. calling select: maxfds is %d\n" _ maxfds); #ifdef HTDEBUG --- 751,763 ---- texceptset = FdArray[HTEvent_INDEX(HTEvent_OOB)]; /* And also get the max socket value */ ! maxfds = MaxSock; ! ! if(maxfds == 0) ! { ! status = HT_ERROR; ! break; /* Why do you need goto's when a break gets to stop_loop? */ ! } HTTRACE(THD_TRACE, "Event Loop.. calling select: maxfds is %d\n" _ maxfds); #ifdef HTDEBUG diff -c -r -X excludedfiles libwww/Library/src/HTHost.c libwww.AIX.copy/Library/src/HTHost.c *** libwww/Library/src/HTHost.c Mon Aug 9 10:18:12 1999 --- libwww.AIX.copy/Library/src/HTHost.c Mon May 8 10:47:20 2000 *************** *** 75,80 **** --- 75,89 ---- /* Delete the channel (if any) */ if (me->channel) { + /* Because we are going to delete the timer and event. */ + /* This needs to be before the HTChannel_delete call. */ + if(HTChannel_socket(me->channel) != INVSOC) + { + HTEvent_unregister(HTChannel_socket(me->channel), HTEvent_READ); + HTEvent_unregister(HTChannel_socket(me->channel), HTEvent_WRITE); + me->registeredFor = 0; + } + HTChannel_setHost(me->channel, NULL); HTChannel_delete(me->channel, HT_OK); me->channel = NULL; } *************** *** 543,548 **** --- 552,575 ---- return HTActiveTimeout; } + /* + ** Get and set the host object timeout. + */ + PUBLIC BOOL HTHost_setObjectTimeout (time_t timeout) + { + if (timeout > 0) + { + HostTimeout = timeout; + return YES; + } + return NO; + } + + PUBLIC time_t HTHost_objectTimeout (void) + { + return HostTimeout; + } + /* Persistent Connection Expiration ** -------------------------------- ** Should normally not be used. If, then use calendar time. *************** *** 1115,1121 **** --- 1142,1150 ---- HTTRACE(CORE_TRACE, "Host Object. keeping persistent socket %d\n" _ HTChannel_socket(host->channel)); if (HTChannel_delete(host->channel, status)) { + #if 0 HTDEBUGBREAK("Host Event.. Channel unexpected deleted from host %p (%s)\n" _ host _ host->hostname); + #endif host->channel = NULL; } /* diff -c -r -X excludedfiles libwww/Library/src/HTHost.h libwww.AIX.copy/Library/src/HTHost.h *** libwww/Library/src/HTHost.h Mon Aug 9 16:29:12 1999 --- libwww.AIX.copy/Library/src/HTHost.h Tue Apr 11 16:46:02 2000 *************** *** 415,420 **** --- 415,426 ---- extern time_t HTHost_persistExpires (HTHost * host); /* + ** Get and set the host object timeout. + */ + extern BOOL HTHost_setObjectTimeout (time_t timeout); + extern time_t HTHost_objectTimeout (void); + + /* ( Keeping Track of Number of Reqeusts )
Received on Monday, 12 June 2000 08:45:47 UTC