summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Henry <josephjah@gmail.com>2016-01-12 13:55:46 -0800
committerJoseph Henry <josephjah@gmail.com>2016-01-12 13:55:46 -0800
commitbd3d9ee3567028d4e852569831a62c71baa389a2 (patch)
treea2b811283033392f0dfa7ab33be3fb6230bc2377
parent76f1ab33f052b661eb45127d1bc98db14f996529 (diff)
downloadinfinitytier-bd3d9ee3567028d4e852569831a62c71baa389a2.tar.gz
infinitytier-bd3d9ee3567028d4e852569831a62c71baa389a2.zip
Removed terminology changes
-rw-r--r--netcon/NetconEthernetTap.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/netcon/NetconEthernetTap.cpp b/netcon/NetconEthernetTap.cpp
index 587b111a..9a9be273 100644
--- a/netcon/NetconEthernetTap.cpp
+++ b/netcon/NetconEthernetTap.cpp
@@ -114,7 +114,7 @@ class TcpConnection
{
public:
- uint64_t accept_canary;
+ uint64_t accept_token;
bool pending, listening;
int pid, idx;
@@ -530,18 +530,18 @@ void NetconEthernetTap::phyOnUnixData(PhySocket *sock,void **uptr,void *data,uns
// STREAM
else {
- int data_start = -1, data_end = -1, canary_pos = -1, padding_pos = -1;
+ int data_start = -1, data_end = -1, token_pos = -1, padding_pos = -1;
char padding[] = {0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89};
dwr(MSG_DEBUG," <%x> stream data, len = %d\n", sock, len);
// Look for padding
std::string padding_pattern(padding, padding+CANARY_PADDING_SIZE);
std::string buffer(buf, buf + len);
padding_pos = buffer.find(padding_pattern);
- canary_pos = padding_pos-CANARY_SIZE;
+ token_pos = padding_pos-CANARY_SIZE;
dwr(MSG_DEBUG, " <%x> padding_pos = %d\n", sock, padding_pos);
- // Grab canary, next we'll use it to look up an RPC job
- if(canary_pos > -1) {
- memcpy(&CANARY_num, buf+canary_pos, CANARY_SIZE);
+ // Grab token, next we'll use it to look up an RPC job
+ if(token_pos > -1) {
+ memcpy(&CANARY_num, buf+token_pos, CANARY_SIZE);
if(CANARY_num != 0) { // TODO: Added to address CANARY_num==0 bug, last seeen 20160108
// Find job
sockdata = jobmap[CANARY_num];
@@ -561,31 +561,31 @@ void NetconEthernetTap::phyOnUnixData(PhySocket *sock,void **uptr,void *data,uns
if(padding_pos == -1) { // [DATA]
memcpy(&conn->buf[conn->idx], buf, wlen);
}
- else { // Padding found, implies a canary is present
- // [CANARY]
- if(len == CANARY_SIZE && canary_pos == 0) {
+ else { // Padding found, implies a token is present
+ // [TOKEN]
+ if(len == TOKEN_SIZE && token_pos == 0) {
wlen = 0; // Nothing to write
}
else {
- // [CANARY] + [DATA]
- if(len > CANARY_SIZE && canary_pos == 0) {
- wlen = len - CANARY_SIZE;
+ // [TOKEN] + [DATA]
+ if(len > TOKEN_SIZE && token_pos == 0) {
+ wlen = len - TOKEN_SIZE;
data_start = padding_pos+CANARY_PADDING_SIZE;
memcpy((&conn->buf)+conn->idx, buf+data_start, wlen);
}
- // [DATA] + [CANARY]
- if(len > CANARY_SIZE && canary_pos > 0 && canary_pos == len - CANARY_SIZE) {
- wlen = len - CANARY_SIZE;
+ // [DATA] + [TOKEN]
+ if(len > TOKEN_SIZE && token_pos > 0 && token_pos == len - TOKEN_SIZE) {
+ wlen = len - TOKEN_SIZE;
data_start = 0;
memcpy((&conn->buf)+conn->idx, buf+data_start, wlen);
}
- // [DATA] + [CANARY] + [DATA]
- if(len > CANARY_SIZE && canary_pos > 0 && len > (canary_pos + CANARY_SIZE)) {
- wlen = len - CANARY_SIZE;
+ // [DATA] + [TOKEN] + [DATA]
+ if(len > TOKEN_SIZE && token_pos > 0 && len > (token_pos + TOKEN_SIZE)) {
+ wlen = len - TOKEN_SIZE;
data_start = 0;
data_end = padding_pos-CANARY_SIZE;
memcpy((&conn->buf)+conn->idx, buf+data_start, (data_end-data_start)+1);
- memcpy((&conn->buf)+conn->idx, buf+(padding_pos+CANARY_PADDING_SIZE), len-(canary_pos+CANARY_SIZE));
+ memcpy((&conn->buf)+conn->idx, buf+(padding_pos+CANARY_PADDING_SIZE), len-(token_pos+TOKEN_SIZE));
}
}
}