aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-13 20:06:01 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-13 20:06:01 +0100
commit7cd99ebc84e5ef4f96bd0d004e0cf511e0e5365f (patch)
treea0ca15512bb915506e51c09153a194d85a7dfb98
parent7253890eaed0b43f306ec5f85015954fdaedda53 (diff)
Reformatted remConnection()
-rw-r--r--FICS/network.c44
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