Changeset 60dfbf
- Timestamp:
- 09/20/09 23:10:39 (3 years ago)
- Branches:
- master
- Children:
- d87432
- Parents:
- 05e99c
- git-author:
- J. A. Bezemer <J.A.Bezemer@…> (09/20/09 23:10:39)
- git-committer:
- Erik Ekman <erik@…> (02/04/12 20:34:04)
- Location:
- src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/dns.c
r595116 r60dfbf 357 357 readshort(packet, &data, &class); 358 358 359 /* if CHECKLEN okay, then we're sure to have a proper name */ 360 if (q != NULL) { 361 /* We only need the first char to check it */ 362 q->name[0] = name[0]; 363 q->name[1] = '\0'; 364 } 365 359 366 /* Assume that first answer is NULL/CNAME that we wanted */ 360 367 readname(packet, packetlen, &data, name, sizeof(name)); -
src/iodined.c
rd4d88d r60dfbf 377 377 users[userid].inpacket.fragment = 0; 378 378 users[userid].fragsize = 100; /* very safe */ 379 users[userid].conn = CONN_DNS_NULL; 379 380 } else { 380 381 /* No space for another user */ -
src/user.c
rb6eb8d r60dfbf 79 79 created_users++; 80 80 } 81 users[i].inpacket.len = 0; 82 users[i].inpacket.offset = 0; 83 users[i].outpacket.len = 0; 84 users[i].q.id = 0; 85 users[i].out_acked_seqno = 0; 86 users[i].out_acked_fragment = 0; 87 users[i].fragsize = 4096; 88 users[i].conn = CONN_DNS_NULL; 81 users[i].active = 0; 82 /* Rest is reset on login ('V' packet) */ 89 83 } 90 84 … … 130 124 int 131 125 all_users_waiting_to_send() 126 /* If this returns true, then reading from tun device is blocked. 127 So only return true when all clients have at least one packet in 128 the outpacket-queue, so that sending back-to-back is possible 129 without going through another select loop. 130 */ 132 131 { 133 132 time_t now; … … 140 139 if (users[i].active && !users[i].disabled && 141 140 users[i].last_pkt + 60 > now && 142 ((users[i].outpacket.len == 0 && users[i].conn == CONN_DNS_NULL) 143 || users[i].conn == CONN_RAW_UDP)) { 141 ((users[i].conn == CONN_RAW_UDP) || 142 ((users[i].conn == CONN_DNS_NULL) 143 #ifdef OUTPACKETQ_LEN 144 && users[i].outpacketq_filled < 1 145 #else 146 && users[i].outpacket.len == 0 147 #endif 148 ))) { 144 149 145 150 ret = 0; -
src/user.h
rc2bc50 r60dfbf 20 20 #define USERS 16 21 21 22 #define OUTPACKETQ_LEN 4 /* Note: 16 users * 1 packet = 1MB */ 23 /* Undefine to have no queue for packets coming in from tun device, which may 24 lead to massive dropping in multi-user situations with high traffic. */ 25 26 #define DNSCACHE_LEN 4 27 /* Undefine to disable. MUST be less than 7; also see comments in iodined.c */ 28 22 29 struct user { 23 30 char id; … … 29 36 struct in_addr host; 30 37 struct query q; 38 struct query q_prev; 39 struct query q_sendrealsoon; 40 int q_sendrealsoon_new; 31 41 struct packet inpacket; 32 42 struct packet outpacket; 43 int outfragresent; 33 44 struct encoder *encoder; 34 45 char downenc; … … 37 48 int fragsize; 38 49 enum connection conn; 50 int lazy; 51 #ifdef OUTPACKETQ_LEN 52 struct packet outpacketq[OUTPACKETQ_LEN]; 53 int outpacketq_nexttouse; 54 int outpacketq_filled; 55 #endif 56 #ifdef DNSCACHE_LEN 57 struct query dnscache_q[DNSCACHE_LEN]; 58 char dnscache_answer[DNSCACHE_LEN][4096]; 59 int dnscache_answerlen[DNSCACHE_LEN]; 60 int dnscache_lastfilled; 61 #endif 39 62 }; 40 63
Note: See TracChangeset
for help on using the changeset viewer.
