There are two types of project: short term projects accomplished usually withing a few weeks and long term ones, that take months even years. Short term projects come with soon-be-over mind set that motivates you to overcome obstacles and solve problems.

Long term projects, however, are easily transformed into slow moving mass of molten lava of not-so-smart client requests, reemerging issues and lost hopes which ultimately leads to frustration – the feeling that you would rather tear of your face, than to [add your work here]. Frustration is not good for you, your code nor your client.
The easy solution would be to focus on short projects: Sign up, code fast, stay up late, deploy, grab cash, run/forget. But (and there is always one) from my experience longer and bigger projects are paid much better. The flow of income is more stable and once you get used to your clients, cooperation can be pretty smooth. So, how can I avoid frustration, that comes with it so I can enjoy advantages of long term projects?
Do something different
If source of you frustration comes from repetitive or similar tasks, go and do something different. I don’t mean just replacing CSS development with voluntary camel feeding at local Zoo. If your schedule allows you start another project and switch between them (just not too often). Doing various stuff helps to suppress the brain-cell-killing feel of monotone work.
Note: That works like a charm for me.
Find solution
Frustration often comes from seemingly unsolvable problem. It can go so far as to you starting to fall behind your schedule because you refused to work on that nasty issue. If you cannot find anyone else to do it, you need to overcome your urge to kill yourself and fix it.
Communicate
Clients sometimes ask weird things. If you come across such request (and believe me you will) talk to client about it – there is nothing worse then to work on something, that does not make sense at all. You are the subject matter expert so reasonable client will listen. If not just do it. You still get paid and you can comfort yourself that you at least tried. Who knows; you may find out, that you were the one missing something.
Ask for more
Ask for more money. It will temporarily help you with your motivation. Just imagine how much [add your favorite item] you could buy with 10% more income.
Quit
If nothing above works quit! Don’t let any project to suck the life out of you.