mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-28 20:45:12 +00:00
Removed unhelpful coding errors.
This commit is contained in:
parent
d8c08191cc
commit
96f9270b7f
@ -397,7 +397,6 @@ send_next_frag(int fd)
|
||||
|
||||
/* Get next fragment to send */
|
||||
f = window_get_next_sending_fragment(outbuf, next_downstream_ack);
|
||||
window_tick(outbuf);
|
||||
if (f == NULL) {
|
||||
if (is_sending()) {
|
||||
/* There is stuff to send but we're out of sync, so send a ping
|
||||
@ -433,6 +432,8 @@ send_next_frag(int fd)
|
||||
datacmc = 0;
|
||||
|
||||
send_query(fd, (char *)buf);
|
||||
|
||||
window_tick(outbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
21
src/user.c
21
src/user.c
@ -135,12 +135,16 @@ find_available_user()
|
||||
for (int u = 0; u < usercount; u++) {
|
||||
/* Not used at all or not used in one minute */
|
||||
if (!user_active(u)) {
|
||||
struct tun_user *user = &users[u];
|
||||
if (user->incoming) window_buffer_destroy(user->incoming);
|
||||
if (user->outgoing) window_buffer_destroy(user->outgoing);
|
||||
/* reset all stats */
|
||||
memset(&users[u], 0, sizeof(users[u]));
|
||||
users[u].active = 1;
|
||||
users[u].last_pkt = time(NULL);
|
||||
users[u].fragsize = MAX_FRAGSIZE;
|
||||
users[u].conn = CONN_DNS_NULL;
|
||||
user->active = 1;
|
||||
user->authenticated = 0;
|
||||
user->authenticated_raw = 0;
|
||||
user->last_pkt = time(NULL);
|
||||
user->fragsize = MAX_FRAGSIZE;
|
||||
user->conn = CONN_DNS_NULL;
|
||||
return u;
|
||||
}
|
||||
}
|
||||
@ -177,12 +181,7 @@ check_user_and_ip(int userid, struct query *q)
|
||||
if (userid < 0 || userid >= created_users ) {
|
||||
return 1;
|
||||
}
|
||||
if (!users[userid].active || users[userid].disabled) {
|
||||
return 1;
|
||||
}
|
||||
if (users[userid].last_pkt + 60 < time(NULL)) {
|
||||
return 1;
|
||||
}
|
||||
if (!user_active(userid)) return 1;
|
||||
|
||||
/* return early if IP checking is disabled */
|
||||
if (!check_ip) {
|
||||
|
@ -56,7 +56,8 @@ window_buffer_init(size_t length, unsigned windowsize, unsigned fragsize, int di
|
||||
void
|
||||
window_buffer_destroy(struct frag_buffer *w)
|
||||
{
|
||||
free(w->frags);
|
||||
if (!w) return;
|
||||
if (w->frags) free(w->frags);
|
||||
free(w);
|
||||
}
|
||||
|
||||
@ -120,7 +121,7 @@ window_reassemble_data(struct frag_buffer *w, uint8_t *data, unsigned maxlen, in
|
||||
// warnx("chunk_start pointing to non-start fragment (%u)!", w->frags[w->chunk_start].seqID);
|
||||
return 0;
|
||||
}
|
||||
*compression = 1;
|
||||
if (compression) *compression = 1;
|
||||
|
||||
fragment *f;
|
||||
size_t i, curseq;
|
||||
@ -139,7 +140,7 @@ window_reassemble_data(struct frag_buffer *w, uint8_t *data, unsigned maxlen, in
|
||||
memcpy(dest, f->data, MIN(fraglen, maxlen));
|
||||
dest += fraglen;
|
||||
datalen += fraglen;
|
||||
*compression &= f->compressed & 1;
|
||||
if (compression) *compression &= f->compressed & 1;
|
||||
if (f->compressed != *compression) {
|
||||
warnx("Inconsistent compression flags in chunk. Not reassembling!");
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user