]> git.sesse.net Git - cubemap/commitdiff
Fix a crash on re-exec if a client was not in SENDING_DATA.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 14 Apr 2013 16:13:08 +0000 (18:13 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 14 Apr 2013 16:13:08 +0000 (18:13 +0200)
client.cpp
server.cpp

index 54373d42ae1b9317f3bf7e7c154130deb2a306b0..f2d60a62653ea13abad4ff9366e8a2e5fa55ca97 100644 (file)
@@ -51,7 +51,7 @@ Client::Client(const ClientProto &serialized, Stream *stream)
          header_or_error_bytes_sent(serialized.header_or_error_bytes_sent()),
          stream_pos(serialized.stream_pos())
 {
-       if (stream->mark_pool != NULL) {
+       if (stream != NULL && stream->mark_pool != NULL) {
                fwmark = stream->mark_pool->get_mark();
        } else {
                fwmark = 0;  // No mark.
index 949d6a4d6958eff742c6c75783ed18f48d7f49c2..9517b5480e5f55ce6c5decee9ab6ad726edf3167 100644 (file)
@@ -153,7 +153,13 @@ void Server::add_client(int sock)
 void Server::add_client_from_serialized(const ClientProto &client)
 {
        MutexLock lock(&mutex);
-       Stream *stream = find_stream(client.stream_id());
+       Stream *stream;
+       map<string, Stream *>::iterator stream_it = streams.find(client.stream_id());
+       if (stream_it == streams.end()) {
+               stream = NULL;
+       } else {
+               stream = stream_it->second;
+       }
        clients.insert(make_pair(client.sock(), Client(client, stream)));
        Client *client_ptr = &clients[client.sock()];