tree checksum vpatch file split hunks
all signers:
antecedents: 9990-keep-ephemeral-ports-open 9991-improved-logging
press order:
genesis | |
9992-handle-edge-cases-add-feedback | |
9991-improved-logging | |
9990-keep-ephemeral-ports-open | |
9989-show-wot-nicks |
patch:
(30 . 6)(30 . 10)- 1FEA4F4A6A2C05324BA98DDF9615BED578E108A6E299A79A10EE5AD3748341F3DF42A4D68799CAD74655BE7AC8820669FC2BA15D72CC6EA6B325F345AD54393B
5 metavar="X",
6 help="load the configfile from X")
7 op.add_option(
8 "-n", "--channel-name",
9 metavar="X",
10 help="specify the channel name for this Pest network")
11 op.add_option(
12 "-d", "--daemon",
13 action="store_true",
14 help="fork and become a daemon")
(84 . 6)(88 . 8)
16 " (requires root)")
17
18 (options, args) = op.parse_args(argv[1:])
19 if options.channel_name is None:
20 options.channel_name = "#pest"
21 if options.debug:
22 options.verbose = True
23 if options.irc_ports is None:
(48 . 7)(48 . 7)- E983984D664DAEF6D42FD55C86F784BFEAD4057B78673C18A8F8E85346DB539F3F3429DE5185A86805A1E698C2907441B5C2017E224BB1606358B930615CE84C
28 return True
29
30 def get_prefix(self):
31 return "%s!%s@%s" % (self.nickname, self.user, self.host)
32 return "%s" % (self.nickname)
33 prefix = property(get_prefix)
34
35 def check_aliveness(self):
(217 . 8)(217 . 8)
37 self.reply("353 %s = %s :%s"
38 % (self.nickname,
39 channelname,
40 " ".join(sorted(x.nickname
41 for x in channel.members))))
42 " ".join(sorted(x
43 for x in self.server.state.get_peer_handles()))))
44 self.reply("366 %s %s :End of NAMES list"
45 % (self.nickname, channelname))
46
(490 . 6)(490 . 7)
48 try:
49 self.server.state.add_peer(arguments[0])
50 self.pest_reply("added new peer %s" % arguments[0])
51 self.message(":%s JOIN %s" % (arguments[0], self.server.channel_name))
52 except:
53 self.pest_reply("error attempting to add peer %s" % arguments[0])
54 else:
(500 . 6)(501 . 7)
56 try:
57 self.server.state.remove_peer(arguments[0])
58 self.pest_reply("removed peer %s" % arguments[0])
59 self.message(":%s PART %s" % (arguments[0], self.server.channel_name))
60 except Exception, e:
61 self.server.print_debug(e)
62 self.pest_reply("Error attempting to remove peer")
(138 . 15)(138 . 16)
67
68 nonce, bounces, version, command, message_bytes = struct.unpack(RED_PACKET_FORMAT, red_packet_bytes)
69
70 # nothing to be done for an IGNORE command
71
72 if command == IGNORE:
73 return Message({"error_code": IGNORED})
74
75 # unpack message
76
77 int_ts, self_chain, net_chain, speaker, message = struct.unpack(MESSAGE_PACKET_FORMAT, message_bytes)
78 speaker = speaker.strip()
79
80 # nothing to be done for an IGNORE command
81
82 if command == IGNORE:
83 return Message({"speaker": speaker, "error_code": IGNORED})
84
85
86 # check timestamp
87
- 7A172DDFD99E3C419BDCA866441AD222790353CA0EDDCB452B6D607E1998041AC0D61E8841D23E82D7C13E850CF7FF01BBFCBA5D1924169795A100C4674BBCB5(1 . 4)(1 . 4)- 7621F8A10842A06CBD590E6DC7460985C762458875771369D1707F24D6449021762A24277E9B1BBB017F5DF601219C8B80A38E6142861503EC7DC265F013A92A
92 VERSION = "9990"
93 VERSION = "9989"
94
95 import os
96 import select
(36 . 6)(36 . 7)
98 def __init__(self, options):
99 self.irc_ports = options.irc_ports
100 self.udp_port = options.udp_port
101 self.channel_name = options.channel_name
102 self.password = options.password
103 self.motdfile = options.motd
104 self.verbose = options.verbose
(163 . 18)(164 . 7)
106 if(error_code == None):
107 self.print_debug("[%s] -> %s" % (peer.handles[0], message.body))
108
109 # we only update the address table if the speaker is same as peer
110
111 try:
112 idx = peer.handles.index(message.speaker)
113 except:
114 idx = None
115
116 if idx != None:
117 self.state.update_address_table({"handle": message.speaker,
118 "address": address[0],
119 "port": address[1]
120 })
121 self.conditionally_update_address_table(peer, message, address)
122 # send the message to all clients
123 for c in self.clients:
124 if (self.clients[c].is_addressed_to_me(message.body)):
(193 . 12)(183 . 26)
126 self.print_debug("[%s:%d] -> malformed packet: %s" % packet_info)
127 return
128 elif error_code == IGNORED:
129 self.conditionally_update_address_table(peer, message, address)
130 self.print_debug("[%s:%d] -> ignoring packet: %s" % packet_info)
131 return
132 elif error_code == INVALID_SIGNATURE:
133 pass
134 self.print_debug("[%s:%d] -> martian packet: %s" % packet_info)
135
136 # we only update the address table if the speaker is same as peer
137
138 def conditionally_update_address_table(self, peer, message, address):
139 try:
140 idx = peer.handles.index(message.speaker)
141 except:
142 idx = None
143
144 if idx != None:
145 self.state.update_address_table({"handle": message.speaker,
146 "address": address[0],
147 "port": address[1]
148 })
149 def peer_message(self, message):
150 message.original = True
151 if message.command == DIRECT:
(175 . 6)(175 . 10)
156 return list(chain.from_iterable(self.cursor.execute("select handle_id from handles where peer_id=?",
157 (peer_id,)).fetchall()))
158
159 def get_peer_handles(self):
160 handles = list(chain.from_iterable(self.cursor.execute("select handle from handles").fetchall()))
161 return handles
162
163 def get_peers(self):
164 peers = []
165 handles = self.cursor.execute("select handle from handles").fetchall()
- 5256691880AA5D35F8534834AD318AFEFB85FE95B62E9AD41FE83C7DCE5D1E4BF4B1727B153492199C3567A77E65A4C36FB644AF046C74C0523511E263353D96(1 . 6)(1 . 6)
170 #!/bin/bash
171
172 # start 3 servers on different ports
173 ./blatta --debug --irc-port 6668 --udp-port 7778 --db-path a.db --address-table-path test_net_configs/a.py > logs/a &
174 ./blatta --debug --irc-port 6669 --udp-port 7779 --db-path b.db --address-table-path test_net_configs/b.py > logs/b &
175 ./blatta --debug --irc-port 6670 --udp-port 7780 --db-path c.db --address-table-path test_net_configs/c.py > logs/c &
176 ./blatta --debug --channel-name \#aleth --irc-port 6668 --udp-port 7778 --db-path a.db --address-table-path test_net_configs/a.py > logs/a &
177 ./blatta --debug --channel-name \#aleth --irc-port 6669 --udp-port 7779 --db-path b.db --address-table-path test_net_configs/b.py > logs/b &
178 ./blatta --debug --channel-name \#aleth --irc-port 6670 --udp-port 7780 --db-path c.db --address-table-path test_net_configs/c.py > logs/c &