summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-09 10:12:34 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-09 10:12:34 +0000
commit0f61489ddb2f54d62c6a59e169901e4a17098230 (patch)
tree03be491da323f94e174ad29f25149fcfce426981
parente964e2286d78ab691078db40e402f685561ef0ca (diff)
Move Blocking/NonBlocking to socket.cpp and make inline
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4806 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/message.h2
-rw-r--r--include/socket.h3
-rw-r--r--src/message.cpp12
-rw-r--r--src/socket.cpp13
4 files changed, 16 insertions, 14 deletions
diff --git a/include/message.h b/include/message.h
index edcda3da9..7d7f4b007 100644
--- a/include/message.h
+++ b/include/message.h
@@ -28,8 +28,6 @@
#include "users.h"
#include "channels.h"
-void Blocking(int s);
-void NonBlocking(int s);
int c_count(userrec* u);
void ChangeName(userrec* user, const char* gecos);
void ChangeDisplayedHost(userrec* user, const char* host);
diff --git a/include/socket.h b/include/socket.h
index 38656e238..ed6373ce8 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -56,6 +56,9 @@ bool MatchCIDR(const char* address, const char* cidr_mask, bool match_with_usern
const char* insp_ntoa(insp_inaddr n);
int insp_aton(const char* a, insp_inaddr* n);
+void Blocking(int s);
+void NonBlocking(int s);
+
int OpenTCPSocket();
bool BindSocket(int sockfd, insp_sockaddr client, insp_sockaddr server, int port, char* addr);
int BindPorts(bool bail);
diff --git a/src/message.cpp b/src/message.cpp
index 9b56cc8ca..e69ce94ab 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -48,18 +48,6 @@ extern std::vector<ircd_module*> factory;
extern time_t TIME;
extern ServerConfig* Config;
-void Blocking(int s)
-{
- int flags = fcntl(s, F_GETFL, 0);
- fcntl(s, F_SETFL, flags ^ O_NONBLOCK);
-}
-
-void NonBlocking(int s)
-{
- int flags = fcntl(s, F_GETFL, 0);
- fcntl(s, F_SETFL, flags | O_NONBLOCK);
-}
-
int c_count(userrec* u)
{
int z = 0;
diff --git a/src/socket.cpp b/src/socket.cpp
index 1916bb555..58e2c5bad 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -209,6 +209,19 @@ bool MatchCIDR(const char* address, const char* cidr_mask, bool match_with_usern
return MatchCIDRBits(addr_raw, mask_raw, bits);
}
+inline void Blocking(int s)
+{
+ int flags = fcntl(s, F_GETFL, 0);
+ fcntl(s, F_SETFL, flags ^ O_NONBLOCK);
+}
+
+inline void NonBlocking(int s)
+{
+ int flags = fcntl(s, F_GETFL, 0);
+ fcntl(s, F_SETFL, flags | O_NONBLOCK);
+}
+
+
/** This will bind a socket to a port. It works for UDP/TCP.
* It can only bind to IP addresses, if you wish to bind to hostnames
* you should first resolve them using class 'Resolver'.