This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Sendq exceeded avoiding script

Support & discussion of released scripts, and announcements of new releases.
Post Reply
C
CP1832
Halfop
Posts: 68
Joined: Thu Oct 09, 2014 4:03 pm

Sendq exceeded avoiding script

Post by CP1832 »

I have an eggdrop that connects to several crowded channels, so every once and again, when the bot crashed or got stoned, the eggdrop would get kicked out of the network because it would exceed the sendq data limit. So to stop that, I had to set some channels to inactive and enable them one at a time. Finally, I figured out that a script should do that. The scripts sets all the bot's channels to inactive when reloading, disconnecting or reconnecting and sets its channel to active one channel at a time after n (in this example, 60) seconds.

Code: Select all

## Delay Join ##

foreach bind [binds join:delay] {lassign $bind type flags mask num proc; unbind $type $flags $mask $proc}
foreach bind [binds inactive] {lassign $bind type flags mask num proc; unbind $type $flags $mask $proc}

set joindelay 60

bind evnt - sigterm inactive
bind evnt - sigill inactive
bind evnt - sigquit inactive
bind evnt - sighup inactive
bind evnt - disconnect-server inactive
bind evnt - loaded inactive
bind evnt - connect-server inactive

proc inactive {type} {
  foreach channel [channels] {
	putlog "Setting $channel to inactive"
	channel set $channel +inactive
  }
}

bind evnt - init-server join:delay

proc join:delay {type} {
	global i joindelay
	if {![info exists i]} {
		set i 0
	}
	if { $i < [ llength [split [channels]] ] } {
		if { $i == 0 } { set chan [ string range [lindex [split [channels]] $i] 1 end-1]
		} else { set chan [lindex [split [channels]] $i] }
		putlog "Setting $chan to active"
		channel set $chan -inactive
    		utimer $joindelay [list join:delay type]
		incr i
	} else { 
		set i 0
	}
}

putlog "Delay join"
User avatar
CrazyCat
Revered One
Posts: 1236
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Not sure to understand why you play with unbinds. And why you bind all the events.

You can just use these two binds:

Code: Select all

bind evnt - connect-server inactive
bind evnt - init-server join:delay
C
CP1832
Halfop
Posts: 68
Joined: Thu Oct 09, 2014 4:03 pm

Post by CP1832 »

CrazyCat wrote:Not sure to understand why you play with unbinds. And why you bind all the events.
I unbind because I forget to unbind when modifying the script and the bind remains.
CrazyCat wrote:You can just use these two binds:

Code: Select all

bind evnt - connect-server inactive
bind evnt - init-server join:delay
That's a good point, I'll modify that.
C
CP1832
Halfop
Posts: 68
Joined: Thu Oct 09, 2014 4:03 pm

Post by CP1832 »

In order to avoid setting channels to active and inactive several times, I added a check to avoid setting its status again and again...

Code: Select all

## Delay Join ##

foreach bind [binds active] {lassign $bind type flags mask num proc; unbind $type $flags $mask $proc}
foreach bind [binds inactive] {lassign $bind type flags mask num proc; unbind $type $flags $mask $proc}

set joindelay 60

bind evnt - connect-server inactive

proc inactive {type} {
  global i
  set i 0
  foreach chan [channels] {
	if {![channel get $chan inactive]} {
	putlog "Passing to inactive $chan"
	channel set $chan +inactive
	}
  }
}

bind evnt - init-server active

proc active {type} {
	global i joindelay
	if {![info exists i]} {
		set i 0
	}
	if { $i < [ llength [split [channels]] ] } {
		if { $i == 0 } { set chan [ string range [lindex [split [channels]] $i] 1 end-1]
		} else { set chan [lindex [split [channels]] $i] }
		if {[channel get $chan inactive]} {
		putlog "Passing to active $chan"
		channel set $chan -inactive 
		}
    		utimer $joindelay [list active type]
		incr i
	} else { 
		set i 0
	}
}

putlog "Delay join"
Post Reply