3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00
Commit Graph

285 Commits

Author SHA1 Message Date
James Lu
56f1c9e919 NetworkCore: fix irc.protoname definition 2017-06-27 16:15:37 -07:00
James Lu
ad2d5a5ae0 Move ts_lock definition into PyLinkNetworkCoreWithUtils 2017-06-27 16:12:45 -07:00
James Lu
928dbf80bb Move more IRC-specific attributes into IRCNetwork.init_vars() 2017-06-27 16:05:58 -07:00
James Lu
62784a63e4 IRCNetwork: error when attempting to start multiple connection threads for a network 2017-06-27 15:58:55 -07:00
James Lu
c3cdf63253 Move some IRC-specific attributes to IRCNetwork 2017-06-27 15:58:38 -07:00
James Lu
fb34392fca IRCNetwork: mark schedule_ping, process_queue as private 2017-06-27 02:53:09 -07:00
James Lu
710a276c45 IRCNetwork: rename run() -> _run_irc(), this is a private function 2017-06-27 01:44:26 -07:00
James Lu
7814914a05 classes, protocols: convert self.irc usage to self 2017-06-25 02:09:52 -07:00
James Lu
eef7a73ce9 classes: migrate self.proto calls to self 2017-06-25 02:09:41 -07:00
James Lu
d0209f720a Rewrite network intitialization bits
- Move protocols.connect -> protocols.post_connect to fix namespace conflict
- Starting an IRC connection is now explicit (via irc.connect instead of __init__)
2017-06-25 01:12:58 -07:00
James Lu
df18e318a8 WIP: merge IRCNetwork and Protocol classes together
Eventually, the goal is to have both of these hotswappable with inheritance, so this distinction becomes moot.
2017-06-24 23:27:24 -07:00
James Lu
7ca98eb965 Split IRC-specific code from classes.Protocol into a new IRCCommonProtocol (#454) 2017-06-16 17:13:26 -07:00
James Lu
37d8e8ad43 Irc: break protocol-agnostic [dis]connect code into _pre/_post functions (#371) 2017-06-16 16:53:23 -07:00
James Lu
2a978c498e Rename PyLinkIRCNetwork -> IRCNetwork
The "PyLink" prefix is sort of redundant here...
2017-06-15 21:55:08 -07:00
James Lu
c4f6d626d5 Drop Irc prefix from IrcServer/User/Channel classes 2017-06-15 21:54:40 -07:00
James Lu
d98d522387 Move Irc.runline => PyLinkNetworkCore.parse_protocol_command 2017-06-15 21:45:04 -07:00
James Lu
47e36a9249 classes: break Irc into three classes: PyLinkNetworkCore, PyLinkNetworkCoreWithUtils, PyLinkIRCNetwork (aliased to Irc) 2017-06-15 21:38:52 -07:00
James Lu
d4fae02540 Irc: migrate functions to camel case 2017-06-02 23:17:14 -07:00
James Lu
f97db31533 Irc: show the current encoding setting in fullVersion() 2017-06-02 08:46:55 -07:00
James Lu
3a934ef5b8 Merge branch 'wip/configurable-encoding' into devel 2017-06-02 07:32:07 -07:00
James Lu
b9aee6ae85 Irc: only apply encoding settings on connect
Changing the encoding after a connection has been established is somewhat dangerous, because it's possible to corrupt channel/user state if characters in the old encoding are no longer valid.

Also, mark this option as experimental.
2017-06-02 07:31:49 -07:00
James Lu
1ff027152a Irc: remove outdated cert/keyfile comment 2017-05-28 20:09:26 -07:00
James Lu
2737b6bbfc Irc: simplify _send() code and replace unencodable characters 2017-05-27 02:21:12 -07:00
James Lu
1246edaf2c Irc: initial work on encoding support (#101) 2017-05-27 01:27:09 -07:00
James Lu
ead20f5be9 Irc: log full tracebacks when disconnecting due to an error 2017-05-16 16:30:03 -07:00
James Lu
fd3236ddb7 Irc: fix another CPU loop on 'disconnect' 2017-05-12 19:52:40 -07:00
James Lu
daa6593534 Irc: block when the queue is empty instead of needlessly polling it
Rework Irc.processQueue() to block when the queue is full, and abort if the item "None" is sent to it.
To make sure that the None isn't caught by a full queue or pushed back by other elements, this modifies queue.Queue's underlying deque instance directly.

Closes #459.
2017-05-12 17:55:24 -07:00
James Lu
06d49f4433 Revert "Irc: only disconnect the write portion of the socket"
This reverts commit f4babc6f28.
2017-05-12 17:19:16 -07:00
James Lu
7daef0000b Irc: break out of processQueue properly when a network disconnects 2017-05-09 23:31:20 -07:00
James Lu
701f01fa4f Irc: reword error message from last commit to be more concise 2017-05-09 18:19:35 -07:00
James Lu
bac6dc36b4 Irc: log socket.send() errors with a proper traceback 2017-05-09 18:06:51 -07:00
James Lu
4ca8667669 Irc: fix 62aea23879 (lowercase queue) 2017-05-07 17:34:04 -07:00
James Lu
62aea23879 Irc: fix throttle_time not actually blocking for the defined amount of time
Passing the timeout to queue.Queue.get is invalid because it'll only block if there ISN'T any text to send.
2017-05-07 17:31:31 -07:00
James Lu
15ed251ed7 Irc: refuse to queue send data if aborted is set 2017-05-07 13:46:25 -07:00
James Lu
de67fe0d37 Irc: log socket shutdown errors to debug 2017-05-07 13:46:15 -07:00
James Lu
f4babc6f28 Irc: only disconnect the write portion of the socket
Per https://docs.python.org/3/howto/sockets.html#disconnecting
2017-05-07 13:46:06 -07:00
James Lu
5d629f7331 matchHost: extend negation via "!" to regular hostmasks as well as exttargets 2017-05-04 19:04:03 -07:00
James Lu
6d96dd21ac updateTS: remove usage of mutable as function default argument
This may subtly break things: https://docs.quantifiedcode.com/python-anti-patterns/correctness/mutable_default_value_as_argument.html
2017-04-09 14:45:12 -07:00
James Lu
348572bcb6 Irc: rewrite sendq to use queue.Queue, and add an upper bound (maxsendq)
Closes #430. Closes #442.
2017-03-31 17:41:56 -07:00
James Lu
9d9b01839c Split Irc.reply() into _reply() to make 'networks.remote' actually thread-safe
Previously, the Irc.reply_lock check was in the reply() function itself: replacing it with another function checking for the same lock would delay execution,
but then run the wrong reply() code if another module used irc.reply() while 'remote' was executing.
2017-03-31 16:25:28 -07:00
James Lu
ae6c68018b core: half the default throttle time (from 0.01 to 0.005) 2017-03-28 22:38:54 -07:00
James Lu
938a1fb9d7 Irc: reorder comments from last commit 2017-03-26 14:25:02 -07:00
James Lu
397df48efd Irc: simplify runloop error catching, adding RuntimeError and SystemExit (closes #438)
socket.error is aliased to OSError since Python 3.3, and ConnectionError is actually a subclass of OSError.
So, it makes more sense to just catch the more generic type here.

Also, make ProtocolError derive from RuntimeError instead of Exception.
2017-03-26 14:17:37 -07:00
James Lu
e3c0bf6a1b Irc: break out of processQueue as soon as self.aborted is set 2017-03-24 18:40:02 -07:00
James Lu
99d3780773 Irc: add locking for reply() calls (#437) 2017-03-24 00:57:21 -07:00
James Lu
ff6d961922 Protocol: add missing self in hasCap() 2017-03-23 22:41:12 -07:00
James Lu
f512ae1b33 Protocol: add a hasCap() wrapper function (#337) 2017-03-15 23:46:13 -07:00
James Lu
2ca0cf05a0 Start work on protocol capabilities (#337) 2017-03-15 23:32:47 -07:00
James Lu
afc5cc26fa Irc: more compact __repr__ for IrcChannel/IrcServer/IrcUser 2017-03-11 22:49:48 -08:00
James Lu
2028cab04c core: Grow autoconnect delays by a configurable factor whenever connections fail
Closes #348.
2017-03-11 00:21:30 -08:00