Updated

A new book that goes behind the scenes of Comedy Central’s “The Daily Show” reveals just how close the network came to losing both Jon Stewart and Stephen Colbert when talks to renew their contracts went awry in 2012.

Released earlier this week, Chris Smith’s “The Daily Show (The Book): An Oral History” goes into excruciating detail about how both men quit in the summer of that year when Viacom’s then-CEO, Philippe Dauman, took a hard line in negotiations, but ended up having to phone Stewart to lure the agent he shared with Colbert back to the negotiating table.

Dauman, who was ousted from the top role at Viacom earlier this year, comes off particularly bad in the book, being described by Stewart and others as being blind to the importance of both stars to the network.

“I don’t think Philippe in any way saw what we do as special,” Stewart said in the book. ” As far as he was concerned the star is the real estate, and whether or not we are the ones who carved out that real estate and made it valuable is not important to them.”

More From Variety

The network found itself in a tough spot of having to negotiate renewals for both Colbert and Stewart at roughly the same time. But when the network surprisingly took a tough stance on Colbert despite the fact he was almost at the peak of his fame, their agent, James Dixon, tied their negotiations together.

But when he couldn’t come to terms over how much time Stewart could take off in 2013 to direct the film “Rosewater,” he and Colbert told Dixon they were done.

“Yeah. There was a time when I quit,” Stewart admits in the book.

Colbert described a conversation telling his incredulous daughter the news of their pending departure, saying he was prepared to wrap up the show three months later in time for Christmas.

“How close can you get to it all falling apart? I mean, Jon quit and we were a package,” Colbert says.

Even Comedy Central chief Doug Herzog criticized Dauman for his handling of the situation. “Philippe definitely leaned into this, and he definitely has a particular approach to negotiation, no matter who it is,” he said.

But Dixon recounts his surprise at getting a call from Dauman after being notified of their planned exits that essentially restarted the negotiations and giving both men the deals they wanted. They signed extensions that kept Stewart into 2015 and Colbert, 2014.

The book also goes into details on other behind-the-scenes negotiations, from ABC’s attempt to give Jon Stewart the late-night hosting gig that eventually went to Jimmy Kimmel in 2002 to Comedy Central’s bungling of John Oliver, who left “The Daily Show” for HBO in 2014.