Class InNetMessagePool

  • All Implemented Interfaces:
    Service

    public class InNetMessagePool
    extends Object
    implements Service
    Manage a pool of inbound InNetMessages. This pool is filled by the Network communication system when it receives messages, and various jobs periodically retrieve them for processing. Actually, this doesn't 'pool' anything, since DISPATCH_DIRECT = true.
    • Constructor Detail

      • InNetMessagePool

        public InNetMessagePool​(RouterContext context)
    • Method Detail

      • add

        public int add​(I2NPMessage messageBody,
                       RouterIdentity fromRouter,
                       Hash fromRouterHash)
        Add a new message to the pool. If there is a HandlerJobBuilder for the inbound message type, the message is loaded into a job created by that builder and queued up for processing instead (though if the builder doesn't create a job, it is added to the pool). Equivalent to the 4-argument version with a 0-value msgIDBloomXor
        Parameters:
        messageBody - non-null
        fromRouter - may be null
        fromRouterHash - may be null, calculated from fromRouter if null
        Returns:
        -1 for some types of errors but not all; 0 otherwise (was queue length, long ago)
      • add

        public int add​(I2NPMessage messageBody,
                       RouterIdentity fromRouter,
                       Hash fromRouterHash,
                       long msgIDBloomXor)
        Add a new message to the pool. If there is a HandlerJobBuilder for the inbound message type, the message is loaded into a job created by that builder and queued up for processing instead (though if the builder doesn't create a job, it is added to the pool) if msgIDBloomXor is 0 the Xor factor is 0, therefore the ID is returned unchanged.
        Parameters:
        messageBody - non-null
        fromRouter - may be null
        fromRouterHash - may be null, calculated from fromRouter if null
        msgIDBloomXor - constant value to XOR with the messageID before passing to the bloom filter.
        Returns:
        -1 for some types of errors but not all; 0 otherwise (was queue length, long ago)
      • handleReplies

        public int handleReplies​(I2NPMessage messageBody)
      • restart

        public void restart()
        does nothing since we aren't threaded
        Specified by:
        restart in interface Service
      • shutdown

        public void shutdown()
        does nothing since we aren't threaded
        Specified by:
        shutdown in interface Service
      • startup

        public void startup()
        does nothing since we aren't threaded
        Specified by:
        startup in interface Service