In unmanned aerial vehicle ad-hoc network (UANET), the network topology changes with time due to the movement of the unmanned aerial vehicles (UAVs), which brings great challenges to the design of the routing protocol. In traditional routing protocols, when UANET topology changes, nodes cannot dynamically update neighbour nodes and topology information, and routing table calculation cannot accurately reflect the actual transmission path. As a result, network cannot meet the quality of service (QoS) requirements such as low end-to-end delay, high throughput and low packet loss rate. This paper proposes a dynamically optimized link state routing (OLSR) protocol based on Deep Q-Network algorithm (DQN-OLSR). In this protocol, each node first adjusts the sending interval of Hello messages adaptively in real time, according to the position and speed information of its neighbour nodes. Then the protocol uses the DQN algorithm to dynamically adjust the flooding interval of topology control (TC) messages to improve the routing update capability of nodes. The simulation verifies that the UANETs under this protocol have higher throughput and less packet loss rate than ad-hoc on-demand distance vector (AODV), grid routing protocol (GRP) and OLSR protocols, at different movement speeds in random waypoint (RWP) and random walk mobile models. Under nomadic as well as pursue mobile models, DQN-OLSR performs consistently with OLSR QoS performance, with the best performance among all four protocols. By further adding positioning errors to the nodes, it shows that the proposed protocol has good robustness, and the QoS performance degradation keeps within a low level.