Dolda2000 GitWeb
/
doldaconnect.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0e227c1
)
Optimized the DC qcommand queue structure.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Sun, 24 Feb 2008 04:14:08 +0000
(
05:14
+0100)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Sun, 24 Feb 2008 04:14:08 +0000
(
05:14
+0100)
daemon/fnet-dc.c
patch
|
blob
|
blame
|
history
diff --git
a/daemon/fnet-dc.c
b/daemon/fnet-dc.c
index
f03458f
..
87671aa
100644
(file)
--- a/
daemon/fnet-dc.c
+++ b/
daemon/fnet-dc.c
@@
-99,12
+99,17
@@
struct qcommand
char *string;
};
char *string;
};
+struct qcmdqueue
+{
+ struct qcommand *f, *l;
+};
+
struct dchub
{
struct socket *sk;
char *inbuf;
size_t inbufdata, inbufsize;
struct dchub
{
struct socket *sk;
char *inbuf;
size_t inbufdata, inbufsize;
- struct qc
ommand *
queue;
+ struct qc
mdqueue
queue;
int extended, dcppemu;
char *charset;
char *nativename;
int extended, dcppemu;
char *charset;
char *nativename;
@@
-130,7
+135,7
@@
struct dcpeer
off_t curread, totalsize;
int freeing;
struct timer *timeout;
off_t curread, totalsize;
int freeing;
struct timer *timeout;
- struct qc
ommand *
queue;
+ struct qc
mdqueue
queue;
struct transfer *transfer;
int state;
int ptclose; /* Close after transfer is complete */
struct transfer *transfer;
int state;
int ptclose; /* Close after transfer is complete */
@@
-376,26
+381,29
@@
static struct dcexppeer *expectpeer(char *nick, struct fnetnode *fn)
return(ep);
}
return(ep);
}
-static struct qcommand *newqcmd(struct qc
ommand *
*queue, char *string)
+static struct qcommand *newqcmd(struct qc
mdqueue
*queue, char *string)
{
struct qcommand *new;
{
struct qcommand *new;
- while(*queue != NULL)
- queue = &(*queue)->next;
new = smalloc(sizeof(*new));
new->string = sstrdup(string);
new = smalloc(sizeof(*new));
new->string = sstrdup(string);
- new->next = *queue;
- *queue = new;
+ new->next = NULL;
+ if(queue->l == NULL)
+ queue->f = new;
+ else
+ queue->l->next = new;
+ queue->l = new;
return(new);
}
return(new);
}
-static struct qcommand *ulqcmd(struct qc
ommand *
*queue)
+static struct qcommand *ulqcmd(struct qc
mdqueue
*queue)
{
struct qcommand *qcmd;
{
struct qcommand *qcmd;
- if((qcmd =
*queue
) == NULL)
+ if((qcmd =
queue->f
) == NULL)
return(NULL);
return(NULL);
- *queue = qcmd->next;
+ if((queue->f = qcmd->next) == NULL)
+ queue->l = NULL;
return(qcmd);
}
return(qcmd);
}