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.
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()];