This is a very open ended issue :)
Ideally if you could confirm that
1) were you able to connect locally on the machine via psql on loopback (localhost) if it was allowed?
2) did logs emit any messages when trying to connect to the server?
3) if you have admin access to server, can you look at dmesg -a output on the reboot. If you mention you had issues with connecting even after restarting postgresql server, but it was fine after a reboot maybe the network interface had some issues. Do you see packet loss on the interface you are connecting to?
4) are there any monitoring enabled or replication enabled for this server ? Were they active or broken while the time you had issues connecting to the server?
5) are you connecting to the server directly or via pgbouncer or other layers ?
What version of postgresql
What client ( from my exp old npgsql clients had some bugs )
Where is it running? Cloud vm, docker ?
Thanks,
Vijay