Possible States For A Hub Connection ==================================== This is a brief summary of possible states a hub connection may be setted. These ideas should later be implemented in a XML file with e.g. a StateXmlParser class with a XmlFileReader as a data source. ------------------------------------------------------------------------------- Initial state | Reason of change | New state ------------------------------------------------------------------------------- New peer | Appears as a simple connection | Connected Connected | Has dropped the connection | Disconnected Connected | Does not do anything within a timeout | Timed out Connected | Tries to send some objects with auth enabled | Message "AUTH" Disconnected | Is purged from the connection list | Removed Timed out | Is being pinged | Pinged Pinged | Does not response on a ping | No response Pinged | Does reply slowly on a ping | Slowed down Pinged | Does reply fast on a ping | No response | Does still not response on X pings | Lost connection No response | Does reply on a ping | Slowed down Slowed down | Does not response on a ping | No response Slowed down | Does still response slow on X extra pings | Karma lose Slowed down | Does reply faster on a ping | Lost connect. | Is maybe disconnected/crashed/etc. | Disconnected Karma lose | Has lost some karma | Add karma | Has gained some karma | ------------------------------------------------------------------------------- Observed | Did not do any annormal activity within time | Removed from O-List Observed | Is being observed for further annormal act. | Removed O-L | Is being removed from observing for ann. ac. | ------------------------------------------------------------------------------- | Does not response within timeout | Message "BANNED" | Sends unexpected network packets | Message "PACKET" "PACKET" | Still sends unexpected network packets | Karma lose "PACKET" | Resends valid network package | "PACKET"+Kar. | Still sends unexpected network packets | Message "BANNED" "PACKET"+Kar. | Resends valid network package | | Does not response within timeout | Pinged ------------------------------------------------------------------------------- "WELCOME" | Tries to send objects with invalid target | Message "TARGET" "WELCOME" | Tries to send objects with valid target | Message "ACCEPT-OBJECT" "WELCOME" | Requests a list of hubs/clients f. inv. obj. | Message "OBJECT" "WELCOME" | Requests a list of hubs/clients f. val. obj. | Message "LIST" "WELCOME" | Sends a list of hubs/clients without offer | Message "OFFER-LIST" "WELCOME" | Offers a list of all invalid objects | Message "ALL-OBJECT-LIST" "WELCOME" | Offers a list with partly invalid objects | Message "PAR-OBJECT-LIST" "WELCOME" | Offers a list of all valid objects | Message "ACCEPT-LIST" "A-L" | Has send a different list of objects | Message "DIV-LIST" "A-L" | Has send the same list of valid objects | Add karma "A-O-L" | Still offers a list of all invalid objects | Karma lose "A-O-L" | Reoffers a list of valid objects | Message "ACCEPT-LIST" "A-O-L"+Karma | Still offers a list of all invalid objects | Message "BANNED" "A-O-L"+Karma | Still offers a list of all invalid objects | Message "ACCEPT-LIST" "A-O-L"+Karma | Reoffers a list of valid objects | Message "ACCEPT-LIST "A-K" | The target rejects the object: "OBJECT" | Message "TARGET-OBJECT" "A-K" | The target rejects the object: "BUSY" | Message "BUSY-OBJECT" "A-O" | Tries to send an invalid object | Message "INVALID-OBJECT" "A-O" | Tries to send a different but valid object | Message "DIV-OBJECT" "A-O" | Sends the same object | Add karma "A/P-T" | Still sends a list of all/partly invalid o. | Karma lose "A/P-T"+Karma | Still sends a list of all/partly invalid o. | Message "BANNED" "P-O-L" | Still offers a list of part. invalid objects | Karma lose "P-O-L" | Resends a list of valid objects | Observe->Message "ACCEPT-LIST" "P-O-L"+Karma | Still offers a list of part. invalid objects | Message "BANNED" "P-O-L"+Karma | Resends a list of valid objects | Observe->Message "ACCEPT-LIST" "I-O" | Still tries to send an invalid object | Karma lose "I-O" | Resends a different invalid object | Message "DIV-OBJECT" "I-O" | Resends the same valid object | Observed "I-O"+Karma | Still tries to send an invalid object | Message "BANNED" "I-O"+Karma | Resends the same valid object | Observed "D-L" | Still sends a different list | Karma lose "D-L" | Resends the same list | Observed "D-L"+Karma | Still sends a different list | Message "BANNED" "D-L"+Karma | Resends the same list | Observed "D-O" | Still tries to send a different object | Karma lose "D-O" | Resends the same valid object | Observed "D-O"+Karma | Still tries to send a different object | Message "BANNED" "D-O"+Karma | Resends the same valid object | Observed "LIST" | The peer receives a list of hubs and clients | "TARGET" | Still tries to send objects to invalid targ. | Karma lose "TARGET" | Sends an object to target with weak karma | Message "ACCEPT-KARMA" "TARGET" | Sends an object to valid target | Message "ACCEPT-OBJECT" "TARGET"+Kar. | Still tries to send objects to invalid targ. | Message "TARGET-KARMA" "T-K" | Still tries to send objects to invalid targ. | Message "BANNED" "T-O" | Target does not accept the obj. but in list | Message "OBJECT-LIST" to target "OBJECT" | Still requests a list f. invalid object | Karma lose "OBJECT"+Kar. | Still requests a list f. invalid object | Message "OBJECT-KARMA "O-K" | Still requests a list f. invalid object | Message "BANNED" "O-L" | Target does still say "ACCEPT" for object | Karma lose "O-L"+Karma | Target does still say "ACCEPT" for object | Message "BANNED" to target "AUTH" | Still tries to send objects after X "AUTH" | Karma lose "AUTH" | Sends valid authorization data | Observe->Message "WELCOME" "AUTH"+Karma | Still tries to send objects after X "AUTH" | Message "BANNED" "AUTH"+Karma | Sends invalid authorization data | Message "KICKED" "AUTH"+Karma | Sends valid authorization data | Observe->Message "WELCOME" "KICKED" | Still authorizes itself with invalid data | Message "BANNED" "BANNED" | Is being banned on the node | Disconnected ------------------------------------------------------------------------------- A previous state is a non-fatal state that the peer was before the trouble started. This state is stored along with a timestamp to watch the overall performance of this hub reacting a troubleous peer. Karma lose or added karma is being remembered in a lose/add-seperated summary for "productive" and addionally as a full list for debugging purposes if the debug mode is enabled. A "connection" should be interpreted as a incoming socket "connection". That means in this state table we threat UDP "connections" as same as TCP connections to make things easier. Of, course the script will be the last one to seperate between these very different protocols. A "ping" is a small message that should be responded by a pinged peer within a time else the ping would loose some karma. When a "ping" is issued it should not be resend within a time period to not ping the peer to death. So pings are not issued while there is no trouble with the peer. This does reduce network load for certain. Troubleous peers are being detected by the above state changes (see Connected->Timed out for example). Some state changes are no *real* state changes. They are sometimes remarks attached to the peer connection. A good example is the state 'Karma lose' which a peer does never change to. A "list" should be interpreted as a DHT (Distributed Hash Table). All list and object transferes are being validated by final hashes for high reliablity.