[Spice-devel,spice-server,07/20] Remove unused and obsolete main_channel_close

Submitted by Frediano Ziglio on Nov. 24, 2016, 5:38 p.m.

Details

Message ID 20161124173907.3341-8-fziglio@redhat.com
State New
Headers show
Series "Start cleaning objects on destruction" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio Nov. 24, 2016, 5:38 p.m.
This function wrongly close the first client.
Wrongly as closing the file descriptor cause a dandling
file descriptor in the object potentially leading
to closing another file descriptor open later.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 server/main-channel.c | 10 ----------
 server/main-channel.h |  1 -
 2 files changed, 11 deletions(-)

Patch hide | download patch | download mbox

diff --git a/server/main-channel.c b/server/main-channel.c
index 6449c16..37b2f25 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -318,16 +318,6 @@  int main_channel_getpeername(MainChannel *main_chan, struct sockaddr *sa, sockle
         getpeername(red_channel_get_first_socket(RED_CHANNEL(main_chan)), sa, salen) : -1;
 }
 
-// TODO: ? shouldn't it disconnect all clients? or shutdown all main_channels?
-void main_channel_close(MainChannel *main_chan)
-{
-    int socketfd;
-
-    if (main_chan && (socketfd = red_channel_get_first_socket(RED_CHANNEL(main_chan))) != -1) {
-        close(socketfd);
-    }
-}
-
 MainChannel* main_channel_new(RedsState *reds)
 {
     // TODO: set the migration flag of the channel
diff --git a/server/main-channel.h b/server/main-channel.h
index 19beb7c..cb53fb4 100644
--- a/server/main-channel.h
+++ b/server/main-channel.h
@@ -61,7 +61,6 @@  RedClient *main_channel_get_client_by_link_id(MainChannel *main_chan, uint32_t l
 MainChannelClient *main_channel_link(MainChannel *, RedClient *client,
      RedsStream *stream, uint32_t link_id, int migration, int num_common_caps,
      uint32_t *common_caps, int num_caps, uint32_t *caps);
-void main_channel_close(MainChannel *main_chan); // not destroy, just socket close
 void main_channel_push_mouse_mode(MainChannel *main_chan, int current_mode, int is_client_mouse_allowed);
 void main_channel_push_agent_connected(MainChannel *main_chan);
 void main_channel_push_agent_disconnected(MainChannel *main_chan);