mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-30 07:35:59 +00:00
Changed: Minor changes
This commit is contained in:
parent
5f912f713a
commit
3b38f01d5f
5 changed files with 210 additions and 174 deletions
|
@ -21,7 +21,7 @@
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Library Includes */
|
/* Library Includes */
|
||||||
#include "wwwsys.h"
|
#include "wwwsys.h"
|
||||||
#include "WWWUtil.h"
|
#include "WWWUtil.h"
|
||||||
#include "WWWCore.h"
|
#include "WWWCore.h"
|
||||||
|
@ -41,8 +41,9 @@ using namespace NLMISC;
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Final states have negative value */
|
/* Final states have negative value */
|
||||||
typedef enum _FileState {
|
typedef enum _FileState
|
||||||
|
{
|
||||||
FS_RETRY = -4,
|
FS_RETRY = -4,
|
||||||
FS_ERROR = -3,
|
FS_ERROR = -3,
|
||||||
FS_NO_DATA = -2,
|
FS_NO_DATA = -2,
|
||||||
|
@ -57,7 +58,8 @@ typedef enum _FileState {
|
||||||
} FileState;
|
} FileState;
|
||||||
|
|
||||||
/* This is the context structure for the this module */
|
/* This is the context structure for the this module */
|
||||||
typedef struct _file_info {
|
typedef struct _file_info
|
||||||
|
{
|
||||||
FileState state; /* Current state of the connection */
|
FileState state; /* Current state of the connection */
|
||||||
char * local; /* Local representation of file name */
|
char * local; /* Local representation of file name */
|
||||||
struct stat stat_info; /* Contains actual file chosen */
|
struct stat stat_info; /* Contains actual file chosen */
|
||||||
|
@ -65,11 +67,13 @@ typedef struct _file_info {
|
||||||
HTTimer * timer;
|
HTTimer * timer;
|
||||||
} file_info;
|
} file_info;
|
||||||
|
|
||||||
struct _HTStream {
|
struct _HTStream
|
||||||
|
{
|
||||||
const HTStreamClass * isa;
|
const HTStreamClass * isa;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _HTInputStream {
|
struct _HTInputStream
|
||||||
|
{
|
||||||
const HTInputStreamClass * isa;
|
const HTInputStreamClass * isa;
|
||||||
HTChannel * ch;
|
HTChannel * ch;
|
||||||
HTHost * host;
|
HTHost * host;
|
||||||
|
@ -123,10 +127,8 @@ PUBLIC int HTLoadNeLFile (SOCKET soc, HTRequest * request)
|
||||||
HTNet * net = HTRequest_net(request);
|
HTNet * net = HTRequest_net(request);
|
||||||
HTParentAnchor * anchor = HTRequest_anchor(request);
|
HTParentAnchor * anchor = HTRequest_anchor(request);
|
||||||
|
|
||||||
HTTRACE(PROT_TRACE, "HTLoadFile.. Looking for `%s\'\n" _
|
HTTRACE(PROT_TRACE, "HTLoadFile.. Looking for `%s\'\n" _ HTAnchor_physical(anchor));
|
||||||
HTAnchor_physical(anchor));
|
if ((file = (file_info *) HT_CALLOC(1, sizeof(file_info))) == NULL) HT_OUTOFMEM("HTLoadFILE");
|
||||||
if ((file = (file_info *) HT_CALLOC(1, sizeof(file_info))) == NULL)
|
|
||||||
HT_OUTOFMEM((char*)"HTLoadFILE");
|
|
||||||
file->state = FS_BEGIN;
|
file->state = FS_BEGIN;
|
||||||
file->net = net;
|
file->net = net;
|
||||||
HTNet_setContext(net, file);
|
HTNet_setContext(net, file);
|
||||||
|
@ -139,8 +141,8 @@ PUBLIC int HTLoadNeLFile (SOCKET soc, HTRequest * request)
|
||||||
PRIVATE int ReturnEvent (HTTimer * timer, void * param, HTEventType /* type */)
|
PRIVATE int ReturnEvent (HTTimer * timer, void * param, HTEventType /* type */)
|
||||||
{
|
{
|
||||||
file_info * file = (file_info *) param;
|
file_info * file = (file_info *) param;
|
||||||
if (timer != file->timer)
|
if (timer != file->timer) HTDEBUGBREAK("File timer %p not in sync\n" _ timer);
|
||||||
HTDEBUGBREAK((char*)"File timer %p not in sync\n" _ timer);
|
|
||||||
HTTRACE(PROT_TRACE, "HTLoadFile.. Continuing %p with timer %p\n" _ file _ timer);
|
HTTRACE(PROT_TRACE, "HTLoadFile.. Continuing %p with timer %p\n" _ file _ timer);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -163,7 +165,7 @@ PUBLIC int HTNeLFileOpen (HTNet * net, char * local, HTLocalMode /* mode */)
|
||||||
|
|
||||||
if (!fp->open (local))
|
if (!fp->open (local))
|
||||||
{
|
{
|
||||||
HTRequest_addSystemError(request, ERR_FATAL, errno, NO, (char*)"CIFile::open");
|
HTRequest_addSystemError(request, ERR_FATAL, errno, NO, "CIFile::open");
|
||||||
return HT_ERROR;
|
return HT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +188,7 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
|
||||||
{
|
{
|
||||||
/* Interrupted */
|
/* Interrupted */
|
||||||
HTRequest_addError(request, ERR_FATAL, NO, HTERR_INTERRUPTED,
|
HTRequest_addError(request, ERR_FATAL, NO, HTERR_INTERRUPTED,
|
||||||
NULL, 0, (char*)"HTLoadFile");
|
NULL, 0, "HTLoadFile");
|
||||||
FileCleanup(request, HT_INTERRUPTED);
|
FileCleanup(request, HT_INTERRUPTED);
|
||||||
return HT_OK;
|
return HT_OK;
|
||||||
}
|
}
|
||||||
|
@ -202,7 +204,7 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
|
||||||
/* We only support safe (GET, HEAD, etc) methods for the moment */
|
/* We only support safe (GET, HEAD, etc) methods for the moment */
|
||||||
if (!HTMethod_isSafe(HTRequest_method(request))) {
|
if (!HTMethod_isSafe(HTRequest_method(request))) {
|
||||||
HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_ALLOWED,
|
HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_ALLOWED,
|
||||||
NULL, 0, (char*)"HTLoadFile");
|
NULL, 0, "HTLoadFile");
|
||||||
file->state = FS_ERROR;
|
file->state = FS_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -235,9 +237,10 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
|
||||||
/* Create a new host object and link it to the net object */
|
/* Create a new host object and link it to the net object */
|
||||||
{
|
{
|
||||||
HTHost * host = NULL;
|
HTHost * host = NULL;
|
||||||
if ((host = HTHost_new((char*)"localhost", 0)) == NULL) return HT_ERROR;
|
if ((host = HTHost_new("localhost", 0)) == NULL) return HT_ERROR;
|
||||||
HTNet_setHost(net, host);
|
HTNet_setHost(net, host);
|
||||||
if (HTHost_addNet(host, net) == HT_PENDING) {
|
if (HTHost_addNet(host, net) == HT_PENDING)
|
||||||
|
{
|
||||||
HTTRACE(PROT_TRACE, "HTLoadFile.. Pending...\n");
|
HTTRACE(PROT_TRACE, "HTLoadFile.. Pending...\n");
|
||||||
/* move to the hack state */
|
/* move to the hack state */
|
||||||
file->state = FS_PENDING;
|
file->state = FS_PENDING;
|
||||||
|
@ -252,7 +255,8 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
|
||||||
HTHost * host = NULL;
|
HTHost * host = NULL;
|
||||||
if ((host = HTHost_new((char*)"localhost", 0)) == NULL) return HT_ERROR;
|
if ((host = HTHost_new((char*)"localhost", 0)) == NULL) return HT_ERROR;
|
||||||
HTNet_setHost(net, host);
|
HTNet_setHost(net, host);
|
||||||
if (HTHost_addNet(host, net) == HT_PENDING) {
|
if (HTHost_addNet(host, net) == HT_PENDING)
|
||||||
|
{
|
||||||
HTTRACE(PROT_TRACE, "HTLoadFile.. Pending...\n");
|
HTTRACE(PROT_TRACE, "HTLoadFile.. Pending...\n");
|
||||||
file->state = FS_PENDING;
|
file->state = FS_PENDING;
|
||||||
return HT_OK;
|
return HT_OK;
|
||||||
|
@ -263,27 +267,31 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
|
||||||
|
|
||||||
case FS_DO_CN:
|
case FS_DO_CN:
|
||||||
if (HTRequest_negotiation(request) &&
|
if (HTRequest_negotiation(request) &&
|
||||||
HTMethod_isSafe(HTRequest_method(request))) {
|
HTMethod_isSafe(HTRequest_method(request)))
|
||||||
|
{
|
||||||
HTAnchor_setPhysical(anchor, file->local);
|
HTAnchor_setPhysical(anchor, file->local);
|
||||||
HTTRACE(PROT_TRACE, "Load File... Found `%s\'\n" _ file->local);
|
HTTRACE(PROT_TRACE, "Load File... Found `%s\'\n" _ file->local);
|
||||||
|
}
|
||||||
} else {
|
else
|
||||||
if (HT_STAT(file->local, &file->stat_info) == -1) {
|
{
|
||||||
|
if (HT_STAT(file->local, &file->stat_info) == -1)
|
||||||
|
{
|
||||||
HTTRACE(PROT_TRACE, "Load File... Not found `%s\'\n" _ file->local);
|
HTTRACE(PROT_TRACE, "Load File... Not found `%s\'\n" _ file->local);
|
||||||
HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_FOUND,
|
HTRequest_addError(request, ERR_FATAL, NO, HTERR_NOT_FOUND, NULL, 0, "HTLoadFile");
|
||||||
NULL, 0, (char*)"HTLoadFile");
|
|
||||||
file->state = FS_ERROR;
|
file->state = FS_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((file->stat_info.st_mode) & S_IFMT) == S_IFDIR) {
|
if (((file->stat_info.st_mode) & S_IFMT) == S_IFDIR)
|
||||||
|
{
|
||||||
if (HTRequest_method(request) == METHOD_GET)
|
if (HTRequest_method(request) == METHOD_GET)
|
||||||
|
{
|
||||||
file->state = FS_PARSE_DIR;
|
file->state = FS_PARSE_DIR;
|
||||||
else {
|
}
|
||||||
HTRequest_addError(request, ERR_INFO, NO, HTERR_NO_CONTENT,
|
else
|
||||||
NULL, 0, (char*)"HTLoadFile");
|
{
|
||||||
|
HTRequest_addError(request, ERR_INFO, NO, HTERR_NO_CONTENT, NULL, 0, "HTLoadFile");
|
||||||
file->state = FS_NO_DATA;
|
file->state = FS_NO_DATA;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -310,20 +318,22 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
|
||||||
HTAnchor_setLastModified(anchor, file->stat_info.st_mtime);
|
HTAnchor_setLastModified(anchor, file->stat_info.st_mtime);
|
||||||
|
|
||||||
/* Check to see if we can edit it */
|
/* Check to see if we can edit it */
|
||||||
if (!editable && !file->stat_info.st_size) {
|
if (!editable && !file->stat_info.st_size)
|
||||||
HTRequest_addError(request, ERR_INFO, NO, HTERR_NO_CONTENT,
|
{
|
||||||
NULL, 0, (char*)"HTLoadFile");
|
HTRequest_addError(request, ERR_INFO, NO, HTERR_NO_CONTENT, NULL, 0, "HTLoadFile");
|
||||||
file->state = FS_NO_DATA;
|
file->state = FS_NO_DATA;
|
||||||
} else {
|
}
|
||||||
file->state = (HTRequest_method(request)==METHOD_GET) ?
|
else
|
||||||
FS_NEED_OPEN_FILE : FS_GOT_DATA;
|
{
|
||||||
|
file->state = (HTRequest_method(request)==METHOD_GET) ? FS_NEED_OPEN_FILE : FS_GOT_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FS_NEED_OPEN_FILE:
|
case FS_NEED_OPEN_FILE:
|
||||||
status = HTNeLFileOpen(net, file->local, HT_FB_RDONLY);
|
status = HTNeLFileOpen(net, file->local, HT_FB_RDONLY);
|
||||||
if (status == HT_OK) {
|
if (status == HT_OK)
|
||||||
|
{
|
||||||
{
|
{
|
||||||
HTStream * rstream = HTStreamStack(HTAnchor_format(anchor),
|
HTStream * rstream = HTStreamStack(HTAnchor_format(anchor),
|
||||||
HTRequest_outputFormat(request),
|
HTRequest_outputFormat(request),
|
||||||
|
@ -338,30 +348,36 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
|
||||||
HTRequest_setInputStream(request, (HTStream *) output);
|
HTRequest_setInputStream(request, (HTStream *) output);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HTRequest_isSource(request) && !HTRequest_destinationsReady(request))
|
if (HTRequest_isSource(request) && !HTRequest_destinationsReady(request)) return HT_OK;
|
||||||
return HT_OK;
|
|
||||||
HTRequest_addError(request, ERR_INFO, NO, HTERR_OK, NULL, 0,
|
HTRequest_addError(request, ERR_INFO, NO, HTERR_OK, NULL, 0, "HTLoadFile");
|
||||||
(char*)"HTLoadFile");
|
|
||||||
file->state = FS_NEED_BODY;
|
file->state = FS_NEED_BODY;
|
||||||
|
|
||||||
if (HTEvent_isCallbacksRegistered()) {
|
if (HTEvent_isCallbacksRegistered())
|
||||||
if (!HTRequest_preemptive(request)) {
|
{
|
||||||
if (!HTNet_preemptive(net)) {
|
if (!HTRequest_preemptive(request))
|
||||||
|
{
|
||||||
|
if (!HTNet_preemptive(net))
|
||||||
|
{
|
||||||
HTTRACE(PROT_TRACE, "HTLoadFile.. Returning\n");
|
HTTRACE(PROT_TRACE, "HTLoadFile.. Returning\n");
|
||||||
HTHost_register(HTNet_host(net), net, HTEvent_READ);
|
HTHost_register(HTNet_host(net), net, HTEvent_READ);
|
||||||
} else if (!file->timer) {
|
}
|
||||||
|
else if (!file->timer)
|
||||||
|
{
|
||||||
HTTRACE(PROT_TRACE, "HTLoadFile.. Returning\n");
|
HTTRACE(PROT_TRACE, "HTLoadFile.. Returning\n");
|
||||||
file->timer =
|
file->timer = HTTimer_new(NULL, ReturnEvent, file, 1, YES, NO);
|
||||||
HTTimer_new(NULL, ReturnEvent, file, 1, YES, NO);
|
|
||||||
}
|
}
|
||||||
return HT_OK;
|
return HT_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (status == HT_WOULD_BLOCK || status == HT_PENDING)
|
}
|
||||||
|
else if (status == HT_WOULD_BLOCK || status == HT_PENDING)
|
||||||
|
{
|
||||||
return HT_OK;
|
return HT_OK;
|
||||||
else {
|
}
|
||||||
HTRequest_addError(request, ERR_INFO, NO, HTERR_INTERNAL,
|
else
|
||||||
NULL, 0, (char*)"HTLoadFile");
|
{
|
||||||
|
HTRequest_addError(request, ERR_INFO, NO, HTERR_INTERNAL, NULL, 0, "HTLoadFile");
|
||||||
file->state = FS_ERROR; /* Error or interrupt */
|
file->state = FS_ERROR; /* Error or interrupt */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -369,12 +385,16 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
|
||||||
case FS_NEED_BODY:
|
case FS_NEED_BODY:
|
||||||
status = HTHost_read(HTNet_host(net), net);
|
status = HTHost_read(HTNet_host(net), net);
|
||||||
if (status == HT_WOULD_BLOCK)
|
if (status == HT_WOULD_BLOCK)
|
||||||
|
{
|
||||||
return HT_OK;
|
return HT_OK;
|
||||||
else if (status == HT_LOADED || status == HT_CLOSED) {
|
}
|
||||||
|
else if (status == HT_LOADED || status == HT_CLOSED)
|
||||||
|
{
|
||||||
file->state = FS_GOT_DATA;
|
file->state = FS_GOT_DATA;
|
||||||
} else {
|
}
|
||||||
HTRequest_addError(request, ERR_INFO, NO, HTERR_FORBIDDEN,
|
else
|
||||||
NULL, 0, (char*)"HTLoadFile");
|
{
|
||||||
|
HTRequest_addError(request, ERR_INFO, NO, HTERR_FORBIDDEN, NULL, 0, "HTLoadFile");
|
||||||
file->state = FS_ERROR;
|
file->state = FS_ERROR;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -386,9 +406,13 @@ PRIVATE int FileEvent (SOCKET /* soc */, void * pVoid, HTEventType type)
|
||||||
char *newname = NULL;
|
char *newname = NULL;
|
||||||
StrAllocCopy(newname, "ftp:");
|
StrAllocCopy(newname, "ftp:");
|
||||||
if (!strncmp(url, "file:", 5))
|
if (!strncmp(url, "file:", 5))
|
||||||
|
{
|
||||||
StrAllocCat(newname, url+5);
|
StrAllocCat(newname, url+5);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
StrAllocCat(newname, url);
|
StrAllocCat(newname, url);
|
||||||
|
}
|
||||||
anchor = HTAnchor_findAddress(newname);
|
anchor = HTAnchor_findAddress(newname);
|
||||||
HTRequest_setAnchor(request, anchor);
|
HTRequest_setAnchor(request, anchor);
|
||||||
HT_FREE(newname);
|
HT_FREE(newname);
|
||||||
|
@ -461,7 +485,8 @@ PRIVATE int HTNeLReader_read (HTInputStream * me)
|
||||||
{
|
{
|
||||||
HTAlertCallback * cbf = HTAlert_find(HT_PROG_READ);
|
HTAlertCallback * cbf = HTAlert_find(HT_PROG_READ);
|
||||||
HTNet_addBytesRead(net, me->b_read);
|
HTNet_addBytesRead(net, me->b_read);
|
||||||
if (cbf) {
|
if (cbf)
|
||||||
|
{
|
||||||
int tr = HTNet_bytesRead(net);
|
int tr = HTNet_bytesRead(net);
|
||||||
(*cbf)(net->request, HT_PROG_READ, HT_MSG_NULL, NULL, &tr, NULL);
|
(*cbf)(net->request, HT_PROG_READ, HT_MSG_NULL, NULL, &tr, NULL);
|
||||||
}
|
}
|
||||||
|
@ -472,18 +497,28 @@ PRIVATE int HTNeLReader_read (HTInputStream * me)
|
||||||
|
|
||||||
/* Now push the data down the stream */
|
/* Now push the data down the stream */
|
||||||
if ((status = (*net->readStream->isa->put_block)
|
if ((status = (*net->readStream->isa->put_block)
|
||||||
(net->readStream, me->data, me->b_read)) != HT_OK) {
|
(net->readStream, me->data, me->b_read)) != HT_OK)
|
||||||
if (status == HT_WOULD_BLOCK) {
|
{
|
||||||
|
if (status == HT_WOULD_BLOCK)
|
||||||
|
{
|
||||||
HTTRACE(PROT_TRACE, "ANSI read... Target WOULD BLOCK\n");
|
HTTRACE(PROT_TRACE, "ANSI read... Target WOULD BLOCK\n");
|
||||||
return HT_WOULD_BLOCK;
|
return HT_WOULD_BLOCK;
|
||||||
} else if (status == HT_PAUSE) {
|
}
|
||||||
|
else if (status == HT_PAUSE)
|
||||||
|
{
|
||||||
HTTRACE(PROT_TRACE, "ANSI read... Target PAUSED\n");
|
HTTRACE(PROT_TRACE, "ANSI read... Target PAUSED\n");
|
||||||
return HT_PAUSE;
|
return HT_PAUSE;
|
||||||
} else if (status > 0) { /* Stream specific return code */
|
}
|
||||||
|
else if (status > 0)
|
||||||
|
{
|
||||||
|
/* Stream specific return code */
|
||||||
HTTRACE(PROT_TRACE, "ANSI read... Target returns %d\n" _ status);
|
HTTRACE(PROT_TRACE, "ANSI read... Target returns %d\n" _ status);
|
||||||
me->write = me->data + me->b_read;
|
me->write = me->data + me->b_read;
|
||||||
return status;
|
return status;
|
||||||
} else { /* We have a real error */
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* We have a real error */
|
||||||
HTTRACE(PROT_TRACE, "ANSI read... Target ERROR\n");
|
HTTRACE(PROT_TRACE, "ANSI read... Target ERROR\n");
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -506,13 +541,15 @@ PRIVATE int HTNeLReader_close (HTInputStream * me)
|
||||||
HTNet * net = HTHost_getReadNet(me->host);
|
HTNet * net = HTHost_getReadNet(me->host);
|
||||||
|
|
||||||
|
|
||||||
if (net && net->readStream) {
|
if (net && net->readStream)
|
||||||
if ((status = (*net->readStream->isa->_free)(net->readStream))==HT_WOULD_BLOCK)
|
{
|
||||||
return HT_WOULD_BLOCK;
|
if ((status = (*net->readStream->isa->_free)(net->readStream))==HT_WOULD_BLOCK) return HT_WOULD_BLOCK;
|
||||||
net->readStream = NULL;
|
net->readStream = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
HTTRACE(STREAM_TRACE, "Socket read. FREEING....\n");
|
HTTRACE(STREAM_TRACE, "Socket read. FREEING....\n");
|
||||||
HT_FREE(me);
|
HT_FREE(me);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,7 +577,8 @@ PRIVATE int HTNeLReader_free (HTInputStream * me)
|
||||||
}
|
}
|
||||||
|
|
||||||
HTNet * net = HTHost_getReadNet(me->host);
|
HTNet * net = HTHost_getReadNet(me->host);
|
||||||
if (net && net->readStream) {
|
if (net && net->readStream)
|
||||||
|
{
|
||||||
int status = (*net->readStream->isa->_free)(net->readStream);
|
int status = (*net->readStream->isa->_free)(net->readStream);
|
||||||
if (status == HT_OK) net->readStream = NULL;
|
if (status == HT_OK) net->readStream = NULL;
|
||||||
return status;
|
return status;
|
||||||
|
@ -551,7 +589,8 @@ PRIVATE int HTNeLReader_free (HTInputStream * me)
|
||||||
PRIVATE int HTNeLReader_abort (HTInputStream * me, HTList * /* e */)
|
PRIVATE int HTNeLReader_abort (HTInputStream * me, HTList * /* e */)
|
||||||
{
|
{
|
||||||
HTNet * net = HTHost_getReadNet(me->host);
|
HTNet * net = HTHost_getReadNet(me->host);
|
||||||
if (net && net->readStream) {
|
if (net && net->readStream)
|
||||||
|
{
|
||||||
int status = (*net->readStream->isa->abort)(net->readStream, NULL);
|
int status = (*net->readStream->isa->abort)(net->readStream, NULL);
|
||||||
if (status != HT_IGNORE) net->readStream = NULL;
|
if (status != HT_IGNORE) net->readStream = NULL;
|
||||||
}
|
}
|
||||||
|
@ -560,7 +599,7 @@ PRIVATE int HTNeLReader_abort (HTInputStream * me, HTList * /* e */)
|
||||||
|
|
||||||
PRIVATE const HTInputStreamClass HTNeLReader =
|
PRIVATE const HTInputStreamClass HTNeLReader =
|
||||||
{
|
{
|
||||||
(char*)"SocketReader",
|
"SocketReader",
|
||||||
HTNeLReader_flush,
|
HTNeLReader_flush,
|
||||||
HTNeLReader_free,
|
HTNeLReader_free,
|
||||||
HTNeLReader_abort,
|
HTNeLReader_abort,
|
||||||
|
@ -569,14 +608,14 @@ PRIVATE const HTInputStreamClass HTNeLReader =
|
||||||
HTNeLReader_consumed
|
HTNeLReader_consumed
|
||||||
};
|
};
|
||||||
|
|
||||||
PUBLIC HTInputStream * HTNeLReader_new (HTHost * host, HTChannel * ch,
|
PUBLIC HTInputStream * HTNeLReader_new (HTHost * host, HTChannel * ch, void * /* param */, int /* mode */)
|
||||||
void * /* param */, int /* mode */)
|
|
||||||
{
|
{
|
||||||
if (host && ch) {
|
if (host && ch)
|
||||||
|
{
|
||||||
HTInputStream * me = HTChannel_input(ch);
|
HTInputStream * me = HTChannel_input(ch);
|
||||||
if (me == NULL) {
|
if (me == NULL)
|
||||||
if ((me=(HTInputStream *) HT_CALLOC(1, sizeof(HTInputStream))) == NULL)
|
{
|
||||||
HT_OUTOFMEM((char*)"HTNeLReader_new");
|
if ((me=(HTInputStream *) HT_CALLOC(1, sizeof(HTInputStream))) == NULL) HT_OUTOFMEM("HTNeLReader_new");
|
||||||
me->isa = &HTNeLReader;
|
me->isa = &HTNeLReader;
|
||||||
me->ch = ch;
|
me->ch = ch;
|
||||||
me->host = host;
|
me->host = host;
|
||||||
|
|
|
@ -71,14 +71,12 @@ void CColorModifier::convertBitmap(NLMISC::CBitmap &destBitmap, const NLMISC::CB
|
||||||
// blend to the destination by using the mask alpha
|
// blend to the destination by using the mask alpha
|
||||||
result.blendFromui(*dest, result, mask->R);
|
result.blendFromui(*dest, result, mask->R);
|
||||||
|
|
||||||
|
|
||||||
/// keep alpha from the source
|
/// keep alpha from the source
|
||||||
dest->R = result.R;
|
dest->R = result.R;
|
||||||
dest->G = result.G;
|
dest->G = result.G;
|
||||||
dest->B = result.B;
|
dest->B = result.B;
|
||||||
dest->A = src->A;
|
dest->A = src->A;
|
||||||
|
|
||||||
|
|
||||||
++ mask;
|
++ mask;
|
||||||
++ src;
|
++ src;
|
||||||
++ dest;
|
++ dest;
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "session_browser.h"
|
#include "session_browser.h"
|
||||||
#include "game_share/ring_session_manager_itf.h"
|
#include "game_share/ring_session_manager_itf.h"
|
||||||
#include "nel/gui/lua_helper.h"
|
#include "nel/gui/lua_helper.h"
|
||||||
using namespace NLGUI;
|
|
||||||
#include "far_tp.h"
|
#include "far_tp.h"
|
||||||
|
|
||||||
class CSessionBrowserImpl : public CSessionBrowser,
|
class CSessionBrowserImpl : public CSessionBrowser,
|
||||||
|
|
|
@ -120,6 +120,5 @@ public:
|
||||||
virtual void callback (const std::string &name, NLNET::TServiceId id);
|
virtual void callback (const std::string &name, NLNET::TServiceId id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,9 @@
|
||||||
|
|
||||||
|
|
||||||
#include "stdpch.h"
|
#include "stdpch.h"
|
||||||
#include <nel/net/service.h>
|
|
||||||
#include "used_continent.h"
|
#include "used_continent.h"
|
||||||
|
#include "nel/net/service.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
Loading…
Reference in a new issue