[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tcldrop/CVS] tcldrop/modules conn.tcl core.tcl
From: |
Philip Moore |
Subject: |
[Tcldrop/CVS] tcldrop/modules conn.tcl core.tcl |
Date: |
Tue, 02 Dec 2003 22:39:43 -0500 |
CVSROOT: /cvsroot/tcldrop
Module name: tcldrop
Branch:
Changes by: Philip Moore <address@hidden> 03/12/02 22:39:42
Modified files:
modules : conn.tcl core.tcl
Log message:
Added support for $log-time to core.tcl
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/conn.tcl.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/core.tcl.diff?tr1=1.31&tr2=1.32&r1=text&r2=text
Patches:
Index: tcldrop/modules/conn.tcl
diff -u tcldrop/modules/conn.tcl:1.10 tcldrop/modules/conn.tcl:1.11
--- tcldrop/modules/conn.tcl:1.10 Tue Dec 2 20:20:16 2003
+++ tcldrop/modules/conn.tcl Tue Dec 2 22:39:41 2003
@@ -3,7 +3,7 @@
# * The connect and control commands, used for all outgoing
connections.
# Depends: idx.
#
-# $Id: conn.tcl,v 1.10 2003/12/03 01:20:16 fireegl Exp $
+# $Id: conn.tcl,v 1.11 2003/12/03 03:39:41 fireegl Exp $
#
# Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
#
@@ -32,7 +32,7 @@
namespace eval ::tcldrop::conn {
variable version {0.7}
package provide tcldrop::conn $version
- variable rcsid {$Id: conn.tcl,v 1.10 2003/12/03 01:20:16 fireegl Exp $}
+ variable rcsid {$Id: conn.tcl,v 1.11 2003/12/03 03:39:41 fireegl Exp $}
variable Defaults
if {![info exists ::my-ip]} { set ::my-ip {} }
set Defaults(global) [list {async} {1} {buffering} {line} {myaddr}
${::my-ip} {blocking} {0} {timeout} {237}]
@@ -92,11 +92,10 @@
set fail [catch { eval {socket} $async {$address} {$port} }
sock]
}
if {!$fail} {
- ::tcldrop::idx::ChInfo $idx [list sock $sock]
fconfigure $sock -buffering $options(buffering) -blocking
$options(blocking)
fileevent $sock writable [list ::tcldrop::conn::Write $idx]
fileevent $sock readable [list ::tcldrop::conn::Read $idx]
- ::tcldrop::idx::ChInfo $idx [list connecttimer [utimer
$options(timeout) [list ::tcldrop::conn::ConnectTimeout $idx]]]
+ ::tcldrop::idx::ChInfo $idx [list sock $sock connecttimer
[utimer $options(timeout) [list ::tcldrop::conn::ConnectTimeout $idx]]]
return $idx
} else {
killidx $idx
@@ -121,7 +120,6 @@
}
}
-
# Note that you can tell connect what command to use with the -control option.
proc ::tcldrop::conn::control {idx command} {
::tcldrop::idx::ChInfo $idx [list control $command]
@@ -129,23 +127,23 @@
proc ::tcldrop::conn::Read {idx} {
foreach {a d} [::tcldrop::idx::Info $idx] { array set idxinfo $d }
- if {![info exists idxinfo(control)]} { return }
if {[set error [fconfigure $idxinfo(sock) -error]] != {}} {
putloglev d * "net: error!(connect) idx $idx (${error})"
- # Send {} to the control proc and kill the sock/idx.
- # Note, A check on valididx (from the control proc) is one way
to tell wether or not an EOF has actually been received.
catch { killutimer $idxinfo(connecttimer) }
+ # Send {} to the control proc and kill the sock/idx. Note, A
check on valididx (from the control proc) is one way to tell wether or not an
EOF has actually been received.
$idxinfo(control) $idx {}
killidx $idx
} elseif {[eof $idxinfo(sock)]} {
putloglev d * "net: eof!(read) idx $idx"
- # Send {} to the control proc and kill the sock/idx.
- # Note, A check on valididx (from the control proc) is one way
to tell wether or not an EOF has actually been received.
+ # Send {} to the control proc and kill the sock/idx. Note, A
check on valididx (from the control proc) is one way to tell wether or not an
EOF has actually been received.
$idxinfo(control) $idx {}
killidx $idx
- } else {
- # For speed, we read in all available lines (This is absolutely
necessary when running inside an Eggdrop, because Eggdrop's event loops are 1
second apart.):
+ } elseif {[info exists idxinfo(control)]} {
+ # For speed, we process all available lines. (This is
absolutely necessary when running inside an Eggdrop, because Eggdrop's event
loops are 1 second apart)
while {[gets $idxinfo(sock) line] >= 1} { $idxinfo(control)
$idx $line }
+ } else {
+ putloglev d * "net: control!(read) idx $idx (no control proc
defined!)"
+ killidx $idx
}
}
Index: tcldrop/modules/core.tcl
diff -u tcldrop/modules/core.tcl:1.31 tcldrop/modules/core.tcl:1.32
--- tcldrop/modules/core.tcl:1.31 Tue Dec 2 04:27:14 2003
+++ tcldrop/modules/core.tcl Tue Dec 2 22:39:41 2003
@@ -1,6 +1,6 @@
# core.tcl --
#
-# $Id: core.tcl,v 1.31 2003/12/02 09:27:14 fireegl Exp $
+# $Id: core.tcl,v 1.32 2003/12/03 03:39:41 fireegl Exp $
#
# Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
#
@@ -47,7 +47,7 @@
# Provide the users module:
variable version {0.4}
package provide tcldrop::core $version
- variable rcsid {$Id: core.tcl,v 1.31 2003/12/02 09:27:14 fireegl Exp $}
+ variable rcsid {$Id: core.tcl,v 1.32 2003/12/03 03:39:41 fireegl Exp $}
# Initialize variables:
variable Binds
variable Timers
@@ -88,6 +88,7 @@
::tcldrop::SetDefault nick {Tcldrop}
::tcldrop::SetDefault lang-path {language}
::tcldrop::SetDefault hourly-updates {00}
+::tcldrop::SetDefault log-time {1}
proc unixtime {} { clock seconds }
@@ -203,6 +204,7 @@
# Use * for all channels, or - to specify that it's global-only.
proc putloglev {levels channel text} {
# Call all of the LOG binds here:
+ if {${::log-time}} { set text "[clock format [clock seconds] -format
{[%H:%M]}] $text" }
foreach b [binds log] {
foreach {type flags mask count proc} $b {}
if {[::tcldrop::CheckFlags $flags $levels] && [string match
-nocase $mask $channel]} {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Tcldrop/CVS] tcldrop/modules conn.tcl core.tcl,
Philip Moore <=