diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2023-12-13 20:06:01 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2023-12-13 20:06:01 +0100 |
commit | 7cd99ebc84e5ef4f96bd0d004e0cf511e0e5365f (patch) | |
tree | a0ca15512bb915506e51c09153a194d85a7dfb98 /FICS/network.c | |
parent | 7253890eaed0b43f306ec5f85015954fdaedda53 (diff) |
Reformatted remConnection()
Diffstat (limited to 'FICS/network.c')
-rw-r--r-- | FICS/network.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/FICS/network.c b/FICS/network.c index 65e34f6..78d2599 100644 --- a/FICS/network.c +++ b/FICS/network.c @@ -91,26 +91,32 @@ PUBLIC int net_addConnection(int fd, unsigned int fromHost) return 0; } -PRIVATE int remConnection(int fd) +PRIVATE int +remConnection(int fd) { - int which; - if ((which = findConnection(fd)) < 0) { - return -1; - } - numConnections--; - con[fd].status = NETSTAT_EMPTY; - if (con[fd].sndbuf == NULL) { - fprintf(stderr, "FICS: remcon(%d) SNAFU, this shouldn't happen.\n", fd); - } else { - if (con[fd].sndbufsize > MAX_STRING_LENGTH) { - con[fd].sndbufsize = MAX_STRING_LENGTH; - con[fd].sndbuf = rrealloc(con[fd].sndbuf, MAX_STRING_LENGTH); - } - if (con[fd].sndbufpos) { /* didn't send everything, bummer */ - con[fd].sndbufpos = 0; - } - } - return 0; + int which; + + if ((which = findConnection(fd)) < 0) + return -1; + numConnections--; + + con[fd].status = NETSTAT_EMPTY; + + if (con[fd].sndbuf == NULL) { + fprintf(stderr, "FICS: remcon(%d) SNAFU, " + "this shouldn't happen.\n", fd); + } else { + if (con[fd].sndbufsize > MAX_STRING_LENGTH) { + con[fd].sndbufsize = MAX_STRING_LENGTH; + con[fd].sndbuf = rrealloc(con[fd].sndbuf, + MAX_STRING_LENGTH); + } + + if (con[fd].sndbufpos) // didn't send everything, bummer + con[fd].sndbufpos = 0; + } + + return 0; } PRIVATE void |