<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/13459" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2008-12-28T08:03:24-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/13459</id>

		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2008-03-09T15:58:58-04:00</updated>

		<published>2008-03-09T15:58:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=81568#p81568</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=81568#p81568"/>
		<title type="html"><![CDATA[Non-blocking use of http::geturl returns results very slow ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=81568#p81568"><![CDATA[
@incith:<br>Errors generated in event-driven code is reported through the bgerror mechanism (since there is no "toplevel" caller which to return the error).<br><br>A very simple way of logging these errors would be something like this:<div class="codebox"><p>Code: </p><pre><code>proc bgerror {message} { putlog "bgerror: $message" putlog " - errorInfo: $::errorInfo" putlog " - errorCode: $::errorCode"}</code></pre></div>Also see <a href="http://www.tcl.tk/man/tcl8.0/TclCmd/bgerror.htm" class="postlink">http://www.tcl.tk/man/tcl8.0/TclCmd/bgerror.htm</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sun Mar 09, 2008 3:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[strikelight]]></name></author>
		<updated>2008-03-09T05:53:18-04:00</updated>

		<published>2008-03-09T05:53:18-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=81555#p81555</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=81555#p81555"/>
		<title type="html"><![CDATA[Non-blocking use of http::geturl returns results very slow ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=81555#p81555"><![CDATA[
What is the cpu consumption of an eggdrop applied with that patch compared to an eggdrop without it applied?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2005">strikelight</a> — Sun Mar 09, 2008 5:53 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[incith]]></name></author>
		<updated>2008-03-09T03:25:30-04:00</updated>

		<published>2008-03-09T03:25:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=81554#p81554</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=81554#p81554"/>
		<title type="html"><![CDATA[Non-blocking use of http::geturl returns results very slow ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=81554#p81554"><![CDATA[
This is why it is a good thing to apply the patch above to your eggdrops source. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>@arfer: Only one is using callback in your example, the one with -command.<br><br>I have begun adding 'variable callback' to my scripts for those of you that do want to enable callback procedures.  I did notice slowdowns still, but nothing too painful.  For others, it is very simple and basically the same as above to add optional callback, something like:<div class="codebox"><p>Code: </p><pre><code>set callback 0/1  # disable/enableif {$callback &gt;= 1} {  set token [::http::geturl -command httpCallbackProcedure BlahBlahBlah]} else {  set token [::http::geturl BlahBlahBlah]  httpCallbackProcedure $token}</code></pre></div>One problem I found was when errors occur in the callback, there is no output or logging.  Even if you call non-existant variables, it just stops at the failing line of code, but doesn't let you know why it stopped.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6130">incith</a> — Sun Mar 09, 2008 3:25 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[strikelight]]></name></author>
		<updated>2008-03-09T01:37:13-04:00</updated>

		<published>2008-03-09T01:37:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=81550#p81550</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=81550#p81550"/>
		<title type="html"><![CDATA[Non-blocking use of http::geturl returns results very slow ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=81550#p81550"><![CDATA[
Not to mention if you have other scripts loaded that require accurate timing or fast execution as well, that they will be unable to do so when the bot is executing that blocked code.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2005">strikelight</a> — Sun Mar 09, 2008 1:37 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2008-03-08T23:18:28-04:00</updated>

		<published>2008-03-08T23:18:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=81547#p81547</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=81547#p81547"/>
		<title type="html"><![CDATA[Non-blocking use of http::geturl returns results very slow ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=81547#p81547"><![CDATA[
The difference in these two cases, are that in pFetch1, the call to ::http::geturl will block until the HTTP transaction is completed and <em class="text-italics">token</em> is ready, and not relying on Tcl_DoOneEvent() being called; whereas in pFetch2, the call to ::http::geturl will return immediately, and launch an event-driven job "in background".<br><br>What might be worth keeping in mind, is that with pFetch1 your eggdrop will become unresponsive until the HTTP transaction is completed. Be careful when selecting timeout values so your bot won't get disconnected (ping timeout)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Mar 08, 2008 11:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[arfer]]></name></author>
		<updated>2008-03-08T21:58:27-04:00</updated>

		<published>2008-03-08T21:58:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=81545#p81545</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=81545#p81545"/>
		<title type="html"><![CDATA[Non-blocking use of http::geturl returns results very slow ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=81545#p81545"><![CDATA[
Perhaps this is relevent here<br><br>I found the same difficulty with execution times and as a solution took to declaring the callback proc outside of the geturl statement to speed things up considerably, as per the following :-<br><br>Two styles of using callback<br><br>pFetch1 proc with call to pCallback outside of the geturl statement executes quite quickly<br><br>pFetch2 proc with the call to pCallback within the geturl statement is comparatively slow to execute<br><br>no idea why<br><br>proc pFetch1 {address} {<br>  set agent [::http::config -useragent "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"]<br>  if {[catch {set token [::http::geturl $address -timeout 10000]}]} {<br>    putlog "cant connect to $address"<br>  } else {pCallback $token}<br>  return 0<br>}<br><br>proc pFetch2 {address} {<br>  set cmd pCallback<br>  set agent [::http::config -useragent "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"]<br>  if {[catch {set token [::http::geturl $address -command $cmd -timeout 10000]}]} {<br>    putlog "cant connect to $address"<br>  }<br>  return 0<br>}<br><br>proc pCallback {token} {<br> # callback code here<br>}<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5705">arfer</a> — Sat Mar 08, 2008 9:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[incith]]></name></author>
		<updated>2008-03-07T23:49:35-04:00</updated>

		<published>2008-03-07T23:49:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=81526#p81526</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=81526#p81526"/>
		<title type="html"><![CDATA[Non-blocking use of http::geturl returns results very slow ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=81526#p81526"><![CDATA[
I jumped the gun a bit, it appears he attached a patch file which does more than just undef USE_TCL_EVENTS.  I will give it a go later on and see if it actually does make Tcl events work properly, and fast.  Second post updated with links.<br><br><em class="text-italics">Update: The patch fixes everything properly.</em><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6130">incith</a> — Fri Mar 07, 2008 11:49 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[strikelight]]></name></author>
		<updated>2008-03-06T23:11:43-04:00</updated>

		<published>2008-03-06T23:11:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=81504#p81504</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=81504#p81504"/>
		<title type="html"><![CDATA[Non-blocking use of http::geturl returns results very slow ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=81504#p81504"><![CDATA[
I'd be interested in knowing how egghttp.tcl compares to the initial poster's script.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2005">strikelight</a> — Thu Mar 06, 2008 11:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[incith]]></name></author>
		<updated>2008-03-06T22:58:33-04:00</updated>

		<published>2008-03-06T22:58:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=81503#p81503</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=81503#p81503"/>
		<title type="html"><![CDATA[Non-blocking use of http::geturl returns results very slow ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=81503#p81503"><![CDATA[
I would say that's a fair assumption.  In my tests, the callback routine will get an incorrect token, which essentially breaks http again, despite improving/fixing the events as well in a way.<br><br>Basically, you will call ::http::geturl, the callback will get ::http::1 and then ::geturl returns ::http::2, which is really bizarre.  After recompiling eggdrop back to normal this behavior disappeared.  So applying the 'patch' above will both fix and break http callbacks.  This lead to some strange things, such as the callback would be trying to work on the previous URL/token, because the ::http::geturl is returning a different token.  I even tried to increment the token, but then the callback didn't have any data to parse because ::http::geturl hadn't actually returned the new token yet.<br><br>Well, hopefully this will be fixed one day as a whole and we can use fast non-blocking events in eggdrop, because the callback was pretty cool even while it was broken. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6130">incith</a> — Thu Mar 06, 2008 10:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[strikelight]]></name></author>
		<updated>2008-03-06T13:15:52-04:00</updated>

		<published>2008-03-06T13:15:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=81483#p81483</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=81483#p81483"/>
		<title type="html"><![CDATA[Non-blocking use of http::geturl returns results very slow ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=81483#p81483"><![CDATA[
I'm pretty sure by undefining that, you are essentially getting rid of non-blocking Tcl operation from eggdrop.  Hence, you may as well just use the blocking method of the http::geturl command.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2005">strikelight</a> — Thu Mar 06, 2008 1:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[incith]]></name></author>
		<updated>2008-12-28T08:03:24-04:00</updated>

		<published>2008-03-06T07:15:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=81477#p81477</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=81477#p81477"/>
		<title type="html"><![CDATA[Non-blocking use of http::geturl returns results very slow ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=81477#p81477"><![CDATA[
It is related to this: <a href="http://www.eggheads.org/pipermail/bugs/2007-February/000960.html" class="postlink">http://www.eggheads.org/pipermail/bugs/ ... 00960.html</a><br><br>There is a patch which he attaches, located here: <a href="http://eggheads.org/pipermail/bugs/attachments/20070221/2dccb15f/tclevent.bin" class="postlink">http://eggheads.org/pipermail/bugs/atta ... levent.bin</a> (<a href="http://incith.com/eggdrop/tclevent.diff" class="postlink">mirror</a>)<br><br><em class="text-italics">Update: The patch above needs to be applied in order for things to work properly.  After applying the above patch, non-blocking http gets work properly and normally.</em><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6130">incith</a> — Thu Mar 06, 2008 7:15 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[madwoota]]></name></author>
		<updated>2007-05-06T01:51:17-04:00</updated>

		<published>2007-05-06T01:51:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=72555#p72555</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=72555#p72555"/>
		<title type="html"><![CDATA[Non-blocking use of http::geturl returns results very slow ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=72555#p72555"><![CDATA[
Can anyone offer any suggestions or reasons why a non-blocking style http get (using the http package) ala <a href="http://forum.egghelp.org/viewtopic.php?p=67616#67616" class="postlink">demonds rssnews</a> script would take such a long time in comparison to a regular get/wait retrieve ?<br><br>I've timed the non-blocking method at ~15-20 seconds whereas a regular (blocking) read/wait only takes ~2-3 seconds.<br><br>Not overly sure what causes the delay. Is this to be expected/normal ?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6569">madwoota</a> — Sun May 06, 2007 1:51 am</p><hr />
]]></content>
	</entry>
	</feed>
