The siege dragged on for two months until Cao Cao ordered his troops to dig ditches to divert the Si River and Yi River () to flood Xiapi. On 7 February 199, Lü Bu's subjects Hou Cheng, Song Xian () and Wei Xu () captured Chen Gong and defected with their troops. Lü Bu made a last stand on the city gate but was eventually overpowered and captured. When brought to Cao Cao, Chen Gong refused to return to his service and chose death so that the law could be upheld; Cao Cao had maintained a general rule that those who surrendered to him, "after" rejecting an initial call from him to surrender, would not be spared. Cao Cao was moved and provided for Chen Gong's family after Chen's death.