Integrated recent changes on SOCKET.socket_buffer splitted as read_socket_buffer and put_socket_buffer.

This commit is contained in:
Jocelyn Fiat
2017-05-15 12:20:52 +02:00
parent 88dec34a1e
commit 485a3812d9
6 changed files with 71 additions and 10 deletions

View File

@@ -58,7 +58,7 @@
<file_rule> <file_rule>
<exclude>/http_stream_socket_ext.e$</exclude> <exclude>/http_stream_socket_ext.e$</exclude>
<condition> <condition>
<version type="compiler" max="16.9.9.9124"/> <version type="compiler" max="17.02"/>
</condition> </condition>
</file_rule> </file_rule>
<cluster name="disabled_ssl_network" location="$|no_ssl\" recursive="true"> <cluster name="disabled_ssl_network" location="$|no_ssl\" recursive="true">
@@ -114,6 +114,11 @@
</condition> </condition>
</cluster> </cluster>
</cluster> </cluster>
<cluster name="network_until_17_01" location=".\src\until_17_01\">
<condition>
<version type="compiler" min="16.9.9.9124" max="17.02"/>
</condition>
</cluster>
</target> </target>
<target name="http_network_ssl" extends="http_network"> <target name="http_network_ssl" extends="http_network">
<variable name="ssl_enabled" value="true"/> <variable name="ssl_enabled" value="true"/>

View File

@@ -58,7 +58,7 @@
<file_rule> <file_rule>
<exclude>/http_stream_socket_ext.e$</exclude> <exclude>/http_stream_socket_ext.e$</exclude>
<condition> <condition>
<version type="compiler" max="16.9.9.9124"/> <version type="compiler" max="17.02"/>
</condition> </condition>
</file_rule> </file_rule>
<cluster name="disabled_ssl_network" location="$|no_ssl\" recursive="true"> <cluster name="disabled_ssl_network" location="$|no_ssl\" recursive="true">
@@ -114,6 +114,11 @@
</condition> </condition>
</cluster> </cluster>
</cluster> </cluster>
<cluster name="network_until_17_01" location=".\src\until_17_01\">
<condition>
<version type="compiler" min="16.9.9.9124" max="17.02"/>
</condition>
</cluster>
</target> </target>
<target name="http_network_ssl" extends="http_network"> <target name="http_network_ssl" extends="http_network">
<variable name="ssl_enabled" value="true"/> <variable name="ssl_enabled" value="true"/>

View File

@@ -36,13 +36,13 @@ feature -- Input
-- Make result available in `last_character'. -- Make result available in `last_character'.
-- No exception raised! -- No exception raised!
do do
read_to_managed_pointer_noexception (socket_buffer, 0, character_8_bytes) read_to_managed_pointer_noexception (read_socket_buffer, 0, character_8_bytes)
if was_error then if was_error then
-- Socket error already set. -- Socket error already set.
elseif bytes_read /= character_8_bytes then elseif bytes_read /= character_8_bytes then
socket_error := "Peer closed connection" socket_error := "Peer closed connection"
else else
last_character := socket_buffer.read_character (0) last_character := read_socket_buffer.read_character (0)
socket_error := Void socket_error := Void
end end
end end
@@ -208,8 +208,8 @@ feature -- Output
put_character_noexception (c: CHARACTER) put_character_noexception (c: CHARACTER)
-- Write character `c' to socket. -- Write character `c' to socket.
do do
socket_buffer.put_character (c, 0) put_socket_buffer.put_character (c, 0)
put_managed_pointer_noexception (socket_buffer, 0, character_8_bytes) put_managed_pointer_noexception (put_socket_buffer, 0, character_8_bytes)
end end
put_string_8_noexception (s: READABLE_STRING_8) put_string_8_noexception (s: READABLE_STRING_8)
@@ -244,7 +244,7 @@ feature -- Status report
end end
note note
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others" copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[ source: "[
Eiffel Software Eiffel Software

View File

@@ -2,12 +2,20 @@ note
description: "[ description: "[
Extension to HTTPD_STREAM_SOCKET to support backward compatibility. Extension to HTTPD_STREAM_SOCKET to support backward compatibility.
TO BE REMOVED IN THE FUTURE, WHEN 16.05 IS OLD. TO BE REMOVED IN THE FUTURE, When there is no need to support older compilers.
]" ]"
deferred class deferred class
HTTP_STREAM_SOCKET_EXT HTTP_STREAM_SOCKET_EXT
feature {NONE} -- No-Exception network operation note
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end end

View File

@@ -51,6 +51,20 @@ feature -- Access
deferred deferred
end end
socket_buffer: MANAGED_POINTER
deferred
end
read_socket_buffer: MANAGED_POINTER
do
Result := socket_buffer
end
put_socket_buffer: MANAGED_POINTER
do
Result := socket_buffer
end
feature -- Socket Recv and Send timeout. feature -- Socket Recv and Send timeout.
set_recv_timeout (a_timeout_seconds: INTEGER) set_recv_timeout (a_timeout_seconds: INTEGER)

View File

@@ -0,0 +1,29 @@
note
description: "[
Extension to HTTPD_STREAM_SOCKET to support backward compatibility.
TO BE REMOVED IN THE FUTURE, WHEN 17.01 IS OLD.
]"
deferred class
HTTP_STREAM_SOCKET_EXT
feature -- Access
socket_buffer: MANAGED_POINTER
deferred
end
read_socket_buffer: MANAGED_POINTER
do
Result := socket_buffer
end
put_socket_buffer: MANAGED_POINTER
do
Result := socket_buffer
end
feature {NONE} -- No-Exception network operation
end