Add checks for invalid socket when creating sockets.
This commit is contained in:
parent
817337af30
commit
21d0cc8cdf
7 changed files with 9 additions and 0 deletions
|
|
@ -249,6 +249,7 @@ proc reconnect*(irc: PIRC, timeout = 5000) =
|
|||
if secSinceReconnect < timeout:
|
||||
sleep(timeout - secSinceReconnect)
|
||||
irc.sock = socket()
|
||||
if irc.sock == InvalidSocket: osError(osLastError())
|
||||
irc.connect()
|
||||
irc.lastReconnect = epochTime()
|
||||
|
||||
|
|
@ -274,6 +275,7 @@ proc irc*(address: string, port: TPort = 6667.TPort,
|
|||
result.messageBuffer = @[]
|
||||
result.status = SockIdle
|
||||
result.sock = socket()
|
||||
if result.sock == InvalidSocket: osError(osLastError())
|
||||
|
||||
proc processLine(irc: PIRC, line: string): TIRCEvent =
|
||||
if line.len == 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue