version 2.12.2.10, 1996/11/11 20:52:04
|
version 2.12.2.11, 1996/11/18 05:00:55
|
Line 105 PRIVATE int HostEvent (SOCKET soc, void
|
Line 105 PRIVATE int HostEvent (SOCKET soc, void
|
targetNet->event.param, type)) != HT_OK) |
targetNet->event.param, type)) != HT_OK) |
return ret; |
return ret; |
} |
} |
|
if (targetNet == NULL && host->remainingRead > 0) { |
|
HTTrace("HostEvent... Error: %d bytes left to read and nowhere to put them\n", host->remainingRead); |
|
host->remainingRead = 0; |
|
/* |
|
** Fall through to close the channel |
|
*/ |
|
} |
/* call pipelined net object to eat all the data in the channel */ |
/* call pipelined net object to eat all the data in the channel */ |
} while (host->remainingRead > 0); |
} while (host->remainingRead > 0); |
|
|
Line 127 PRIVATE int HostEvent (SOCKET soc, void
|
Line 134 PRIVATE int HostEvent (SOCKET soc, void
|
return HT_OK; /* extra garbage does not constitute an application error */ |
return HT_OK; /* extra garbage does not constitute an application error */ |
|
|
} else if (type == HTEvent_WRITE) { |
} else if (type == HTEvent_WRITE) { |
HTNet * targetNet = (HTNet *)HTList_lastObject(host->pipeline); |
HTNet * targetNet = (HTNet *)HTList_lastObject(host->pipeline); |
if (targetNet) { |
if (targetNet) { |
if (CORE_TRACE) |
if (CORE_TRACE) |
HTWATCH(HTWatch_TCP, host, HTHIDE("HostEvent: WRITE passed to %s.\n"), |
HTWATCH(HTWatch_TCP, host, HTHIDE("HostEvent: WRITE passed to %s.\n"), |
Line 1062 PUBLIC int HTHost_hash (HTHost * host)
|
Line 1069 PUBLIC int HTHost_hash (HTHost * host)
|
{ |
{ |
return host ? host->hash : -1; |
return host ? host->hash : -1; |
} |
} |
|
|
|
PUBLIC int HTHost_writeDelay(HTHost * host, int lastFlushTime, int buffSize) |
|
{ |
|
if (host->forceWriteFlush) |
|
return 0; |
|
return 1000; |
|
} |
|
|
|
PUBLIC int HTHost_forceFlush(HTHost * host) |
|
{ |
|
HTNet * targetNet = (HTNet *)HTList_lastObject(host->pipeline); |
|
int wasForced = host->forceWriteFlush; |
|
int ret; |
|
if (targetNet == NULL) |
|
return HT_ERROR; |
|
if (CORE_TRACE) |
|
HTWATCH(HTWatch_TCP, host, HTHIDE("HostEvent: FLUSH passed to %s.\n"), |
|
HTHIDE(HTAnchor_physical(HTRequest_anchor(HTNet_request(targetNet))))); |
|
host->forceWriteFlush = YES; |
|
ret = (*targetNet->event.cbf)(HTChannel_socket(host->channel), targetNet->event.param, HTEvent_FLUSH); |
|
host->forceWriteFlush = wasForced; |
|
return ret; |
|
} |
|
|
|
#if 0 |
|
PRIVATE int lazyWriteFlushEvent (SOCKET soc, void * pVoid, HTEventType type) |
|
{ |
|
HTOutputStream * stream = (HTOutputStream *) pVoid; |
|
HTBufferWriter_reallyFlush(me); |
|
return HT_OK; |
|
} |
|
|
|
/* |
|
** HTHost_lazyFlush(host, cbf) - call cbf with an HTEvent_TIMEOUT |
|
** when the host's write interval has expired. |
|
*/ |
|
PUBLIC int HTHost_lazyFlush (HTHost * host, int (*lazyFlush)(HTOutputStream *)) |
|
{ |
|
/* |
|
** If we are allowed to delay the flush then register an event with the |
|
** delay descibed by our delay variable. If we can't delay then flush |
|
** right away. |
|
*/ |
|
if (host->delay_output) { |
|
HTChannel * ch = HTHost_channel(host); |
|
me->delay_event = HTEvent_new(FlushEvent, host, HT_PRIORITY_MAX, me->delay_ms); |
|
HTEvent_register(HTChannel_socket(ch), HTEvent_TIMEOUT, me->delay_event); |
|
me->delaying = YES; |
|
if (PROT_TRACE) HTTrace("Buffer...... Waiting...\n"); |
|
|
|
int delay_ms; /* Delay in ms */ |
|
BOOL delaying; |
|
HTEvent * delay_event; |
|
me->delay_ms = 10000; |
|
|
|
PUBLIC int HTHost_cancelLazyFlush(me->host) |
|
if (me->delay_event && me->delaying) { |
|
HTChannel * ch = HTHost_channel(me->host); |
|
HTEvent_unregister(HTChannel_socket(ch), HTEvent_TIMEOUT); |
|
me->delaying = NO; |
|
} |
|
#endif /* 0 */ |
|
|