What’s the solution here??

My husband has been unhappy with me and we are working thru some things. Some days are fine, other days really suck. He’s upset with me and I’m trying to gain back his confidence in me. On days where it’s bad.. he doesn’t want to talk and he gets really down and just seems unhappy with life (ex. I know he’s down, I gave him a long hug and told him I’m so sorry. He said please get off I don’t feel like being touched right now. And so I just backed off.) Part of his problem with me is in situations like this, he expects me to fight for our marriage and prove to him I care about him and us. I already know where things will go when he’s in this state of mind... more fighting and screaming. I do not want our 3 year old seeing us screaming. So I prefer to talk about things when he is napping/sleeping. Also, Is that healthy to shield our child from this? I don’t know even know where to go from here in this vicious cycle. It is bothering me so bad that my eyes are obviously not seeing any solution here. I’m really trying to make this work. We’ve been together 17 years and I just can’t see us ending. I realize we both deserve to be happy. Am I crazy to think this can be fixed? Sorry, I’m all over the place.