I always carry my 31" ASP baton on my mountain bike. I also carry blade, or 3.
I encounter dogs all the time, while on dog walks. I walk my Pitbull with my bike, so she can run.
Aggressive dogs don't give warning, they don't growl, they will just attack.
A scared dog will growl and show it's teeth. If you stand your ground, show no fear, they will usually back down. This might take several minutes, and they might be defending a territory.
You have to protect yourself if attacked, but why shoot an animal that's just scared. My Pit was attacked by two other pits, on two seperate occasions. The first time, their owner and I were able to pull them apart, that took 5 minutes. The second time I had my baton. Without extending it, I popped them on their heads. They went home.
The owner was to blame, not the dogs. They are unsocialized, and had no training, and no leashes. Stupid people should not have powerful breeds, or powerful anything.