summaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
authorGravatar brain2006-08-09 10:12:34 +0000
committerGravatar brain2006-08-09 10:12:34 +0000
commit0f61489ddb2f54d62c6a59e169901e4a17098230 (patch)
tree03be491da323f94e174ad29f25149fcfce426981 /src/socket.cpp
parentcommon_channels -> userrec::SharesChannelWith() (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
Diffstat (limited to 'src/socket.cpp')
-rw-r--r--src/socket.cpp13
1 files changed, 13 insertions, 0 deletions
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'.