tree checksum vpatch file split hunks
all signers: lobbes bvt diana_coman asciilifeform
antecedents: raw_line_export.kv active_disconnect_r3.kv sept_fixes.kv sept_errata.kv
press order:
patch:
(12 . 3)(12 . 4)
5 596907 sept_fixes asciilifeform "Several small improvements to bot and reader."
6 597604 active_disconnect bvt "Close current connection before opening a new one. Disable Nagle's algorithm. s/Listen/Receive/."
7 597688 sept_errata asciilifeform "Fixed coarse mistake in reader.py"
8 597858 detect_disconnect asciilifeform "Adjustable detector of bot disconnection."
- 1F4326CF8D7A7AC9CCD54DA9CCC56B4C5EEF008245933A2905A87978AABDB27D438C8BDD2430275AE75C5CE2A4D335DF9FBD1F671A69D046B12F7CF2F57B4AE9(118 . 3)(118 . 21)
13 trilema;1937941;1569445079;diana_coman;wb BingoBoingo !
14
15 Still needs a variant of 'eater' that will eat these.
16
17 ###############
18 Oct. 4 Update:
19 ###############
20
21 (1) WWW: Removed ill-conceived 'Tape' knob.
22 (2) Bot: Added silent-disconnection detector.
23
24 Now requires the following value in bot config e.g.:
25
26 [irc]
27 disc_t = 180
28
29 This represents the currently-recommended interval: 3 minutes.
30 If inactivity on the incoming line (incl. pingism) exceeds this interval,
31 a disconnection is forced. The normal reconnection routine will execute.
32
33 To disable forced disconnects, set disc_t to zero.
- EDA2C9E8930F8207A7588763084768F494B4CAD89C6CCCEC07E9C7412AE8CE238A07B970A7F937048B7CAE1F5D7D92CF67ED88E9802A7694CE0CB274D9A81DD3(14 . 7)(14 . 7)- 61C5DF75C043B567B3F5FC2150C4D7C1D31B6FD04A356CFC9280728F88D71C739D4A6B425C3EDCC1B8BE55AA2FD4BA589E8FE9405060299E2E876A5169D1C0D6
38 ##############################################################################
39
40 # Version. If changing this program, always set this to same # as in MANIFEST
41 Ver = 597604
42 Ver = 597858
43
44 ##############################################################################
45
(66 . 6)(66 . 7)
47 Pass = cfg.get("irc", "pass")
48 Channels = [x.strip() for x in cfg.get("irc", "chans").split(',')]
49 Join_Delay = int(cfg.get("irc", "join_t"))
50 Discon_TO = int(cfg.get("irc", "disc_t"))
51 Prefix = cfg.get("control", "prefix")
52 # DBism:
53 DB_Name = cfg.get("db", "db_name")
(129 . 6)(130 . 9)
55 # Used to compute 'uptime'
56 time_last_conn = datetime.now()
57
58 # Used to monitor disconnection timeout
59 time_last_recv = datetime.now()
60
61 # Socket will be here:
62 sock = None;
63
(244 . 6)(248 . 7)
65 def irc():
66 global connected
67 global time_last_conn
68 global time_last_recv
69 global sock
70
71 # Initialize a socket
(274 . 8)(279 . 15)
73 while connected:
74 try:
75 data = sock.recv(Buf_Size)
76 time_last_recv = datetime.now() # Received anything -- reset timer
77 except socket.timeout as e:
78 logging.debug("Receive timed out")
79 # Determine whether the connection has timed out:
80 since_recv = (datetime.now() - time_last_recv).seconds
81 if since_recv > Discon_TO:
82 logging.info("Exceeded %d seconds of silence " % Discon_TO
83 + "from server: disconnecting!")
84 deinit_socket()
85 continue
86 except socket.error as e:
87 logging.warning("Receive socket error, disconnecting.")
(19 . 6)(19 . 9)
92 # How long to wait for fleanode to ack auth of nick before joining chans
93 join_t = 20
94
95 # Force-disconnect after this many seconds of complete (incl. 0 PINGs) silence
96 disc_t = 180
97
98 # Verbose barf of irc tx/rx
99 irc_dbg = 0
100
- 433CB3B45EBE59D30A4E2C8CE965BB756E34196F1FC14256620D4A9226EF5AD6E3B707E33D40BF6FAEBECF18178A0E6F982D48D17924585FA103EB9CC99532D4(447 . 49)(447 . 6)
105 return Response(res, mimetype='text/plain')
106
107
108 # "Tape" is a raw log containing entried from ALL logged chans:
109 @app.route('/tape')
110 def tape():
111 res = ""
112
113 # Get start and end indices:
114 idx_start = request.args.get('istart', default = 0, type = int)
115 idx_end = request.args.get('iend', default = 0, type = int)
116
117 # Malformed bounds?
118 if idx_start > idx_end:
119 return Response("EGGOG: Start must precede End!",
120 mimetype='text/plain')
121
122 # Demanded too many in one burst ?
123 if (idx_end - idx_start) > Max_Raw_Ln :
124 return Response("EGGOG: May request Max. of %s Lines !" % Max_Raw_Ln,
125 mimetype='text/plain')
126
127 # Get the loglines from DB
128 lines = query_db(
129 '''select * from loglines where
130 idx between %s and %s order by idx asc;''',
131 [idx_start, idx_end], one=False)
132
133 # Retrieve raw lines in Tape format:
134 for l in lines:
135 action = ""
136 speaker = "%s;" % l['speaker']
137 if l['self']:
138 action = "*;"
139 speaker = "%s " % l['speaker']
140 res += "%s;%s;%s;%s%s%s\n" % (l['chan'],
141 l['idx'],
142 l['t'].strftime('%s'),
143 action,
144 speaker,
145 l['payload'])
146
147 # Return plain text:
148 return Response(res, mimetype='text/plain')
149
150
151 Name_Chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-"
152
153 def sanitize_speaker(s):