diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/SCsub | 63 | ||||
-rw-r--r-- | drivers/openssl/stream_peer_openssl.cpp | 7 | ||||
-rw-r--r-- | drivers/openssl/stream_peer_openssl.h | 2 | ||||
-rw-r--r-- | drivers/unix/stream_peer_tcp_posix.cpp | 9 | ||||
-rw-r--r-- | drivers/unix/stream_peer_tcp_posix.h | 2 |
5 files changed, 53 insertions, 30 deletions
diff --git a/drivers/SCsub b/drivers/SCsub index 8e241830f8..e52d6538e5 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -61,39 +61,42 @@ import string if env['vsproj']=="yes": env.AddToVSProject(env.drivers_sources) -for f in env.drivers_sources: - fname = "" - if type(f) == type(""): - fname = env.File(f).path - else: - fname = env.File(f)[0].path - fname = fname.replace("\\", "/") - base = string.join(fname.split("/")[:2], "/") - if base != cur_base and len(list) > max_src: - if num > 0: - lib = env.Library("drivers"+str(num), list) - lib_list.append(lib) - list = [] - num = num+1 - cur_base = base - list.append(f) +if (False): #split drivers, this used to be needed for windows until separate builders for windows were created -lib = env.Library("drivers"+str(num), list) -lib_list.append(lib) + for f in env.drivers_sources: + fname = "" + if type(f) == type(""): + fname = env.File(f).path + else: + fname = env.File(f)[0].path + fname = fname.replace("\\", "/") + base = string.join(fname.split("/")[:2], "/") + if base != cur_base and len(list) > max_src: + if num > 0: + lib = env.Library("drivers"+str(num), list) + lib_list.append(lib) + list = [] + num = num+1 + cur_base = base + list.append(f) -if len(lib_list) > 0: - import os, sys - if os.name=='posix' and sys.platform=='msys': - env.Replace(ARFLAGS=['rcsT']) + lib = env.Library("drivers"+str(num), list) + lib_list.append(lib) - lib = env.Library("drivers_collated", lib_list) - lib_list = [lib] + if len(lib_list) > 0: + import os, sys + if os.name=='posix' and sys.platform=='msys': + env.Replace(ARFLAGS=['rcsT']) -drivers_base=[] -env.add_source_files(drivers_base,"*.cpp") -lib_list.insert(0, env.Library("drivers", drivers_base)) + lib = env.Library("drivers_collated", lib_list) + lib_list = [lib] -env.Prepend(LIBS=lib_list) + drivers_base=[] + env.add_source_files(drivers_base,"*.cpp") + lib_list.insert(0, env.Library("drivers", drivers_base)) -#lib = env.Library("drivers",env.drivers_sources) -#env.Prepend(LIBS=[lib]) + env.Prepend(LIBS=lib_list) +else: + env.add_source_files(env.drivers_sources,"*.cpp") + lib = env.Library("drivers",env.drivers_sources) + env.Prepend(LIBS=[lib]) diff --git a/drivers/openssl/stream_peer_openssl.cpp b/drivers/openssl/stream_peer_openssl.cpp index ef07f11334..81795fdc60 100644 --- a/drivers/openssl/stream_peer_openssl.cpp +++ b/drivers/openssl/stream_peer_openssl.cpp @@ -479,6 +479,13 @@ Error StreamPeerOpenSSL::get_partial_data(uint8_t* p_buffer, int p_bytes,int &r_ return OK; } +int StreamPeerOpenSSL::get_available_bytes() const { + + ERR_FAIL_COND_V(!connected,0); + + return SSL_pending(ssl); + +} StreamPeerOpenSSL::StreamPeerOpenSSL() { ctx=NULL; diff --git a/drivers/openssl/stream_peer_openssl.h b/drivers/openssl/stream_peer_openssl.h index a66b641dd4..64f5a1d7ac 100644 --- a/drivers/openssl/stream_peer_openssl.h +++ b/drivers/openssl/stream_peer_openssl.h @@ -71,6 +71,8 @@ public: virtual Error get_data(uint8_t* p_buffer, int p_bytes); virtual Error get_partial_data(uint8_t* p_buffer, int p_bytes,int &r_received); + virtual int get_available_bytes() const; + static void initialize_ssl(); static void finalize_ssl(); diff --git a/drivers/unix/stream_peer_tcp_posix.cpp b/drivers/unix/stream_peer_tcp_posix.cpp index 5aa3915893..edf5e02971 100644 --- a/drivers/unix/stream_peer_tcp_posix.cpp +++ b/drivers/unix/stream_peer_tcp_posix.cpp @@ -38,6 +38,7 @@ #include <string.h> #include <netdb.h> #include <sys/types.h> +#include <sys/ioctl.h> #ifndef NO_FCNTL #ifdef __HAIKU__ #include <fcntl.h> @@ -367,6 +368,14 @@ Error StreamPeerTCPPosix::get_partial_data(uint8_t* p_buffer, int p_bytes,int &r return read(p_buffer, p_bytes, r_received, false); }; +int StreamPeerTCPPosix::get_available_bytes() const { + + unsigned long len; + int ret = ioctl(sockfd,FIONREAD,&len); + ERR_FAIL_COND_V(ret==-1,0) + return len; + +} IP_Address StreamPeerTCPPosix::get_connected_host() const { return peer_host; diff --git a/drivers/unix/stream_peer_tcp_posix.h b/drivers/unix/stream_peer_tcp_posix.h index 9b1716ac42..817f24c91c 100644 --- a/drivers/unix/stream_peer_tcp_posix.h +++ b/drivers/unix/stream_peer_tcp_posix.h @@ -67,6 +67,8 @@ public: virtual Error get_data(uint8_t* p_buffer, int p_bytes); virtual Error get_partial_data(uint8_t* p_buffer, int p_bytes,int &r_received); + virtual int get_available_bytes() const; + void set_socket(int p_sockfd, IP_Address p_host, int p_port); virtual IP_Address get_connected_host() const; |