You might be connected to both pools, but only working for one: When you mine, the block you are trying to find contains a recipient address for the block reward. Therefore, a block can only contribute to one mining pool (i.e. the one that would be receiving the reward, if the block was successful).
Whenever you find a block, the
#allblocks mentioned in the linked thread, causes the block to be propagated to all connected pools. This will cause your block to be distributed quicker and prevent selfish mining:
Selfish mining is something else than you seem to think: It describes a behavior, where a pool will keep a discovered block private, until another party finds a block or the pool itself finds a succeeding block. That way the pool can hinder other parties to base work on the discovered block, and can gain a "headstart" on a succeeding block.
Due to you submitting your block to the pool and also propagating it to the network, the pool operator can't keep the block hidden and therefore cannot perform selfish mining.