IRCaBot 2.1.0
GPLv3 © acetone, 2021-2022
#ls2
/2022/12/17
@eyedeekay
+R4SAS
+RN
+T3s|4
+Xeha
+acetone
+orignal
Irc2PGuest46917
Irc2PGuest95022
Onn4l7h
Onn4|7h
T3s|4_
anon1
cancername
eyedeekay_bnc
goose2
goose2_
j6
profetikla
shiver_1
u5657
weko_
x74a6
z0a1
orignal gents we also see some issue
dr|z3d what you got, orignal?
orignal Charlie receives RelayIntro and can't find Alice's RI
orignal my question
orignal how Java sends Alice's RI?
orignal in the same packet or diferent?
dr|z3d // Send Alice RI and forward data in a Relay Intro to Charlie
dr|z3d if (_log.shouldInfo())
dr|z3d _log.info("Received relay request from " + alice
dr|z3d + " for tag " + tag
dr|z3d + " nonce " + nonce
dr|z3d + " and relaying with " + charlie);
dr|z3d DatabaseStoreMessage dbsm = new DatabaseStoreMessage(_context);
dr|z3d dbsm.setEntry(aliceRI);
dr|z3d dbsm.setMessageExpiration(now + 10*1000);
dr|z3d _transport.send(dbsm, charlie);
dr|z3d // put alice hash in intro data
dr|z3d byte[] idata = new byte[1 + Hash.HASH_LENGTH + data.length];
dr|z3d //idata[0] = 0; // flag
dr|z3d System.arraycopy(alice.getRemotePeer().getData(), 0, idata, 1, Hash.HASH_LENGTH);
dr|z3d System.arraycopy(data, 0, idata, 1 + Hash.HASH_LENGTH, data.length);
dr|z3d packet = _builder2.buildRelayIntro(idata, (PeerState2) charlie);
dr|z3d charlie.setLastSendTime(now);
orignal and where is RI?
orignal please tell me
orignal same packet or different?
dr|z3d that's a good question, zzz will have to answer that one, not clear to me.
dr|z3d obviously _transport.send(dbsm, charlie); is where the RI gets sent.
dr|z3d though packet = _builder2.buildRelayIntro(idata, (PeerState2) charlie); suggests a new packet?
orignal let's wait for zzz
zzz orignal, different packet, and because of the way our priority queues work, the RI probably gets sent after the peer test msg ((
zzz I have a timer to wait a while if I don't have the RI... I haven't fixed the send order yet
dr|z3d so format headers places the header in both request and response headers, as you mentioned, zzz. immediately above if (conn == null || !conn.toLowerCase(Locale.US).contains("upgrade")) places the header in the request header only. so I'm a bit stumped about how to get the header in _the response_ only.
zzz stand by...
zzz dr|z3d, do it above the formatHeaders() call for the response
dr|z3d so in between these 2 lines?
dr|z3d Map<String, List<String>> headers = readHeaders(null, serverin, command, SERVER_SKIPHEADERS, _ctx);
dr|z3d String modifiedHeaders = formatHeaders(headers, command);
zzz correct
dr|z3d ok, thanks. I think I looked at that before, figured serverin as probably what I wanted, but wasn't sure how to append a new header.
dr|z3d I tried to copy shouldCompress() and do a shouldAddCacheControl() but that didn't work.
dr|z3d ok, let's see if setEntry(headers, "Cache-Control", "private, no-cache, max-age=604800"); did the job. then I just have to detect if we already have a cache-control header present.
dr|z3d fantastic. works!
dr|z3d // add cache-control headers if none present
dr|z3d String cc = getEntryOrNull(headers, "Cache-Control");
dr|z3d if (cc == null || !cc.toLowerCase(Locale.US).contains("cache-control"))
dr|z3d setEntry(headers, "Cache-Control", "private, no-cache, max-age=604800");
dr|z3d well, mostly. apparently it's still sending a truncated header as the request. :|
dr|z3d Response -> Cache-Control: private, no-cache, max-age=604800
dr|z3d Request: -> Cache-Control: no-cache
orignal zzz so how do you handle it?
orignal it's not peer test it's relay
zzz sorry, same strategy with relay
zzz I'll look and see if I can fix the reordering
orignal for how long do you wait?
dr|z3d thanks, zzz, it appears it *is* working, seems the browser's adding a no-cache request header.
zzz orignal, looks like I recheck at 50/150/350/750/1550 ms, so about 1.5 seconds max
orignal thanks
zzz also, I was wrong, I don't do any of this for peer test, only for relay
zzz working on it now. sorry I didn't get to it before the release.
dr|z3d damn, zzz, you busy lately.
dr|z3d I blink and there's 1/2 dozen new commits.
zzz so. many. bugs.
zzz I got a huge peer test fixup coming next week but have to wait for the ls2 meeting
dr|z3d I got another quick q for you :)
zzz shoot
dr|z3d likely a noob q, but I'm having difficulty working out this cannot be referenced from a static context jazz.
zzz lets say you had:
zzz private foo bar;
dr|z3d trying to call getTunnel().getClientOpts()
dr|z3d basically I'm trying to include addHeaders as an option so it can be turned off in the tunnel configs.
zzz private void splat() { ... }
zzz static void test() {
dr|z3d yeah, tried that, didn't work.
zzz splat(); // illegal
zzz bar = foo; // illegal
dr|z3d private boolean shouldAddResponseHeaders() {
dr|z3d Properties opts = getTunnel().getClientOptions();
dr|z3d String addHeaders = opts.getProperty(OPT_ADD_RESPONSE_HEADERS);
dr|z3d if (addHeaders.toLowerCase() == "false") {
dr|z3d return false;
dr|z3d } else {
dr|z3d return true;
dr|z3d so I can just add a void and I'm good?
zzz shouldAddResponseHeaders() is inside a static class, right?
dr|z3d well, no, not right now. it's right at the bottom of the file, outside of everything aside the main public non-static class.
zzz then where is the _call_ to shouldAdd... ? inside a static class, right?
dr|z3d that's inside public void run() {...}
zzz but what's that inside?
dr|z3d ah, yeah, that's inside private static class CompressedRequestor implements Runnable {...}
zzz you can't ever go from a static thing to a non-static thing outside of the static thing
dr|z3d yeah, I get that much from reading various docs and stackoverflow, but beyond that I'm a bit lost. :|
dr|z3d usually I just poke around your code until I find the solution, but can't see anything obvious here.
dr|z3d (or I throw in the towel and back out whatever changes I made)
zzz simplest fix:
zzz move the shouldAdd() call and pass the result to the CompressedReqestor constructor
zzz like:
zzz boolean shouldadd = shouldAdd()
zzz new CompressedRequestor(all the other args, shouldadd);
zzz and then in the constructor:
zzz _shouldAdd = shouldAdd
dr|z3d ok, I had most of that pencilled in already, maybe not the boolean shouldAdd() though. thanks, I'll see if I can make that work.
zzz that works because it moves the shouldAdd() call out of the static context
zzz other way may be to just make compressedrequestor non-static, simpler but a little less efficient
dr|z3d there's something I made non-static which got everything to compile, but then web page requests just timed out (504'd)
dr|z3d it might have been private static class CompressedResponseOutputStream extends HTTPResponseOutputStream {..}
dr|z3d actually, no, not that.
dr|z3d yeah, might have been CompressedRequestor
dr|z3d anyways, thanks, you'd given me some useful leads. let's see if I can make it happen.
dr|z3d *you've
zzz here's the way I think of it
zzz everything non-static is "inside" something else
zzz everything static is "outside" it
zzz there's two ways to get to something "inside":
zzz if you're "inside" too
zzz or if you have a reference to the containing thing, e.g. foo.getBar()
dr|z3d ok, thanks for the pointer. that kinda makes sense :)
obscuratus For years, I thought my understanding of 'static' variables met the standard of "Perfect is the Enemy of Good-Enough".
obscuratus But, I recently decided to bone-up on 'static' variables, and it was time well spent.
obscuratus I concluded my standard for "Good-Enough" was lacking in this case.