There’s nothing like soldiering through an eight- or nine-hour flight in economy followed by a mile-long line at customs to find out your flight has been canceled—trust me, I’ve been there, more than once. Swearing and crying—maybe busting out the wine you bought for dad at the duty-free—are in order, but not recommended. At least, not until after you’ve got everything rebooked. Here’s how to manage when your flight is canceled:

1. Don’t panic, make a scene, or get obnoxious with airline personnel.
They have no control over what happened to you, and are dealing with a couple hundred other people (at minimum) in your exact same situation. Be kind—to yourself, to airline staff, and to fellow passengers. And don’t be fooled: The shouty, rude passenger gets rebooked last—and in a middle seat, not an upgrade.

2. Call the airline while you wait in line to speak to an agent on-site.
If you’re a member of the airline’s miles program, or have an associated credit card, call the special contact number on the back of your card. You may get through sooner and get better treatment than you would from harried employees at the airport. You can also try to rebook your flight online.

3. Know your rights.
Depending on the duration of your flight, and where it originates, you have certain rights if the flight falls through. Be aware, though, because sometimes even airline employees aren’t completely informed about what they owe passengers. You may have to bring up the airline’s own webpage on your smartphone, or be able to show them in-country regulations.

For flights originating in the European Union, or arriving in the European Union on a European carrier, passengers have the right to meal and/or hotel vouchers for flights that are delayed three hours or more. If the delay is five hours or more, passengers can also get a refund. And if the flight is canceled, passengers have the right to alternate transportation in lieu of a refund. In some circumstances, passengers may also have the right to additional compensation, such as financial compensation of €250–600. This depends on the distance flown, and does not apply to flights delayed due to extraordinary circumstances, such as bad weather.

In the United States your rights vary from carrier to carrier, but Federal rules guarantee your right to a refund or a reroute.

4. Get creative.
If you need to get somewhere in a hurry, consider rebooking with another airline, flying into a different destination, making more connections, or even transferring to and flying out from a nearby airport. Make sure you keep your airline informed, so you can have your luggage delivered to your final destination and so you don’t get booted off your return flight. (They may try to bump you off the return anyway, but if you keep them informed you stand a better chance of avoiding this.)

5. Trade your time for free travel.
If you’re not in a hurry, offer to be last in line—for a price. Tell staff you’re willing to wait on standby as long as it takes, in exchange for miles or credit. Make sure to negotiate hotel and food vouchers to keep you comfortable during your wait, especially if you’re not at home.

And finally, two things you should really do before you travel, just in case:

1. Download and use the airline’s app.
I know, I know, who needs yet another app? Still, while you’re traveling, the app will help you keep track of delays and cancellations, and may allow you to rebook your own flight.

2. Buy insurance.
Shop for third-party travel insurance (I like World Nomads) that covers travel delays, so that when you get stuck somewhere, you don’t have the worry about the extra expense on top of everything else. With most policies, after a small co-pay, incidental costs (hotel, food, transportation, lost luggage) are covered.

Photo by rudlavibizon/Flickr

For more airline tips, read up on 13 Ways to Make Flying Much Easier.