What does impertinent mean (from The American)?

Impertinent is an adjective that means disrespectful, ill-mannered, insolent, or impudent. Impertinent can also mean not pertinent, or irrelevant; having no connection with a given matter.

In the Henry James novel The American, Valentin tells Newman he has a special reason for rejoining Noémie at the opera. Her companion has been insulting, and Valentin wants to give the gentleman a chance to be openly insulting. Thus, Valentin can challenge him to a duel; it is a point of honor.

In my absence this gentleman came in and took the chair beside Noémie in which I had been sitting. My reappearance disgusted him, and he [showed] it. He came within an ace of being impertinent. I don't know who he is; he is some vulgar wretch. I can't think where she picks up such acquaintances.