I don't think you want to return here, or if you have found the
server, you don't send the flags and the 124 bytes of zeroes (the bit
marked "common"), etc.
Actually, you do. negotiate() is called once more, in mainloop(),
unconditionally. At that point, negotiate() skips the first block of
'common' code (due to client and client->modern being set), and the
first block of 'modern' code (due to client being set), but continues at
the second block of 'common' code. By not returning at that position,
the 'client' variable in serveloop never gets anything assigned in the
case of the modern socket.